Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-5042

ResultSet.updateBoolean() on new BOOLEAN type throws exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.7.1.1
    • 10.8.1.2
    • Network Client
    • None
    • OS X 10.6.5, Java 1.6
    • Embedded/Client difference

    Description

      I am encountering an error trying to update a BOOLEAN type through an
      updatable ResultSet. My table looks like this:

      CREATE TABLE file_store (
      path VARCHAR(255) NOT NULL,
      network VARCHAR(32) NOT NULL,
      file_blob BLOB,
      file_md5 VARCHAR(32),
      is_directory BOOLEAN NOT NULL DEFAULT false,
      PRIMARY KEY (path, network)
      );

      My SQL looks like this:

      SELECT path, network, is_directory FROM file_store
      WHERE path=? AND network=? AND is_directory=true FOR UPDATE OF path, network, is_directory

      My Java code looks like this:

      ...
      resultSet.moveToInsertRow();
      resultSet.updateString("path", dirPath);
      resultSet.updateString("network", network);
      resultSet.updateBoolean("is_directory", true);
      resultSet.insertRow();

      An exception is thrown in the call to updateBoolean() as follows:

      java.sql.SQLException: An attempt was made to put a data value of type 'byte' into a data value of type 'BOOLEAN'.

      It's a shame, I was looking forward to using the new BOOLEAN type before I roll out the next version of our software. For now I will fallback to SMALLINT. Does/will ALTER TABLE support a change from SMALLINT to BOOLEAN?

      Attachments

        1. derby-5042-1a.diff
          3 kB
          Knut Anders Hatlen

        Issue Links

          Activity

            People

              knutanders Knut Anders Hatlen
              brettw Brett Wooldridge
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: