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

parametric insert faiure with mixed int/bigint params

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Duplicate
    • 10.6.1.0
    • None
    • JDBC
    • None
    • Win XP - SP3 - JDK 1.6.0_17
    • 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)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ice1972 RobertoC
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: