Derby
  1. Derby
  2. DERBY-4749

parametric insert faiure with mixed int/bigint params

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Duplicate
    • Affects Version/s: 10.6.1.0
    • Fix Version/s: None
    • Component/s: JDBC
    • Labels:
      None
    • Environment:
      Win XP - SP3 - JDK 1.6.0_17
    • Urgency:
      Blocker

      Description

      Derby raise an exception on the INSERT:
      INSERT INTO email2folder (idEmail,idFolder) SELECT idEmail,? FROM email2folder WHERE id IN

      passing a java array as params-container: new Number

      {new Integer(12), new Long(1)}

      ;

      Replacing "?" with values, into INSERT, works correctly (but I must use params, by project requirements).

      As shown in the below table structure "idEmail" is a BIGINT while "idFolder" is an INTEGER.
      So params-array is supplied with two different object's classes.

      Tables:
      -----------------------------------
      CREATE TABLE email2folder (
      id bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY NOT NULL,
      idemail bigint NOT NULL,
      idfolder integer NOT NULL
      );

      Exception:
      ------------------------------

      Caused by: java.lang.RuntimeException: SQL=INSERT INTO email2folder (idEmail,idFolder) SELECT idEmail,? FROM email2folder WHERE id IN
      at datamgr.sql.SQLConnection.executeParameterizedUpdate(SQLConnection.java:256)
      at datamgr.sql.ShareableSQLConnection.executeParameterizedUpdate(ShareableSQLConnection.java:79)
      ... 7 more
      Caused by: java.sql.SQLException: Eccezione Java: ': java.lang.NullPointerException'.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement40.<init>(Unknown Source)
      at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
      at datamgr.sql.SQLConnection.executeParameterizedUpdate(SQLConnection.java:243)

        Issue Links

          Activity

          Gavin made changes -
          Workflow jira [ 12516088 ] Default workflow, editable Closed status [ 12800477 ]
          Knut Anders Hatlen made changes -
          Link This issue duplicates DERBY-4671 [ DERBY-4671 ]
          Knut Anders Hatlen made changes -
          Field Original Value New Value
          Status Open [ 1 ] Closed [ 6 ]
          Bug behavior facts [Crash]
          Resolution Duplicate [ 3 ]
          Hide
          Knut Anders Hatlen added a comment -

          This looks like a duplicate of DERBY-4671.

          It should be possible to work around the bug by adding a cast operator around the the parameter in the select list, like this:

          INSERT INTO email2folder (idEmail,idFolder) SELECT idEmail, CAST(? AS INT) FROM email2folder WHERE id IN

          Show
          Knut Anders Hatlen added a comment - This looks like a duplicate of DERBY-4671 . It should be possible to work around the bug by adding a cast operator around the the parameter in the select list, like this: INSERT INTO email2folder (idEmail,idFolder) SELECT idEmail, CAST(? AS INT) FROM email2folder WHERE id IN
          RobertoC created issue -

            People

            • Assignee:
              Unassigned
              Reporter:
              RobertoC
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development