United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6460067 : A call to QueryObjectFactory.createDefaultQueryObject() loses the con object of a preceding call

Details
Type:
Bug
Submit Date:
2006-08-14
Status:
Closed
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2006-08-23
Component:
core-libs
OS:
windows_2000
Sub-Component:
java.sql
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Relates:

Sub Tasks

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
EVALUATION

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

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



Hardware and Software, Engineered to Work Together