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

PreparedStatement#setObject(int parameterIndex, Object x) throws SQL Exception when binding Short value in embedded mode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.1.1.0, 10.1.3.1
    • 10.1.3.2, 10.2.1.6
    • JDBC
    • None
    • WindowsXP
    • Normal

    Description

      When trying to insert a row into the table

      SHORT_TEST( ID int, SHORT_VAL smallint)

      an exception is thrown, if the object value given to PreparedStatement#setObject(int parameterIndex, Object x) is of type Short. The exception thrown is:

      — SQLException —
      SQLState: 22005
      Message: An attempt was made to get a data value of type 'SMALLINT' from a data value of type 'java.lang.Short'.
      ErrorCode: 20000
      SQL Exception: An attempt was made to get a data value of type 'SMALLINT' from a data value of type 'java.lang.Short'.
      at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.ConnectionChild.newSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement.dataTypeConversion(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement.setObject(Unknown Source)

      Tested on Derby 10.1.1.0 and 10.1.3.1. The same test runs fine in network mode.

      Attachments

        1. derby-1500.diff
          102 kB
          Knut Anders Hatlen
        2. derby-1500.stat
          1 kB
          Knut Anders Hatlen
        3. ShortTest.java
          4 kB
          Markus Fuchs

        Issue Links

          Activity

            People

              knutanders Knut Anders Hatlen
              m_fuchs Markus Fuchs
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: