JDK-6460067 : A call to QueryObjectFactory.createDefaultQueryObject() loses the con object of a preceding call
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.sql
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2006-08-14
  • Updated: 2011-02-16
  • Resolved: 2006-08-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b98Fixed
Related Reports
Relates :  
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

Comments
SUGGESTED FIX Fixed as bug fix for 6458333. Please see that bug for more details.
23-08-2006

EVALUATION This issue is similar to 6458333. Will be fixed as part of its bug fix.
22-08-2006