Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6460067

A call to QueryObjectFactory.createDefaultQueryObject() loses the con object of a preceding call

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      b95
    • Introduced In Version:
      6
    • Resolved In Build:
      b98
    • CPU:
      x86
    • OS:
      windows_2000
    • Verification:
      Verified

      Description

      The attached test case creates two Connection objects, uses each to get its own Query object by invoking QueryObjectFactory.createDefaultQueryObject(), then closes the second connection. The application uses the first connection to create a table, but when it attempts to get a DataSet with this connection, a runtime exception ("No current connection") is thrown. So, although the Connection is open and can be used by the application, it is no longer available to the JDBC implementation.

      If the second call (using the second connection) to QueryObjectFactory.createDefaultQueryObject is not made, no runtime exception is thrown.

      The complete output is:

      Creating con1
      Creating con2
      Creating addressQuery1 with con1.
      Creating addressQuery2 with con2. If this step is omitted, getting addressesDataSet1 with con1 succeeds.
      Closing con2
      Is con1 closed? false
      Is con2 closed? true
      Creating table with con1
      Successfully created table with con1
      Getting addressesDataSet1 with con1
      Failed to get addressesDataSet1. con1 is no longer available to EoD. Stack trace follows
      java.sql.SQLRuntimeException: java.sql.SQLTransientConnectionException: No current connection.
              at com.sun.sql.QueryObjectGeneratorImpl$2.run(QueryObjectGeneratorImpl.java:225)
              at java.security.AccessController.doPrivileged(Native Method)
              at com.sun.sql.QueryObjectGeneratorImpl.invoke(QueryObjectGeneratorImpl.java:217)
              at $Proxy0.getAddresses(Unknown Source)
              at TwoConTest.main(TwoConTest.java:84)
      Caused by: java.sql.SQLTransientConnectionException: No current connection.
              at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
              at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
              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.newEmbedSQLException(Unknown Source)
              at org.apache.derby.impl.jdbc.Util.noCurrentConnection(Unknown Source)
              at org.apache.derby.impl.jdbc.EmbedConnection.checkIfClosed(Unknown Source)
              at org.apache.derby.impl.jdbc.EmbedConnection.setupContextStack(Unknown Source)
              at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
              at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
              at com.sun.sql.QueryObjectGeneratorImpl.getQueryImpl(QueryObjectGeneratorImpl.java:762)
              at com.sun.sql.QueryObjectGeneratorImpl.access$100(QueryObjectGeneratorImpl.java:24)
              at com.sun.sql.QueryObjectGeneratorImpl$2.run(QueryObjectGeneratorImpl.java:222)
              ... 4 more
      Caused by: SQL Exception: No current connection.
              ... 17 more
      Dropping table with con1
      Successfully dropped table with con1
      Closing con1

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kssaxena Kshitiz Saxena (Inactive)
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: