[ http://issues.apache.org/jira/browse/DERBY-2084?page=comments#action_12450323 ] Bernt M. Johnsen commented on DERBY-2084: -----------------------------------------
Dan: It dosen't matter, since I was wrong. Deepa: The current implementation is correct. You need to temporarily turn off autocommit because there may be open result-sets when getTransactionIsolation(). > getTransactionIsolation() in network client should not activate a transaction > ----------------------------------------------------------------------------- > > Key: DERBY-2084 > URL: http://issues.apache.org/jira/browse/DERBY-2084 > Project: Derby > Issue Type: Bug > Components: Network Client > Affects Versions: 10.2.1.6, 10.1.3.1, 10.3.0.0 > Reporter: Bernt M. Johnsen > Assigned To: Bernt M. Johnsen > Attachments: DERBY-2084.diff > > > getTransactionIsolation() is implemented by means of > rs = getTransactionIsolationStmt.executeQuery("values current > isolation"); > This will activate a transaction. Thus the code snippet > Connection conn = > DriverManager.getConnection(url); > conn.setAutoCommit(false); > int tx = conn.getTransactionIsolation(); > conn.close(); > will fail with > java.sql.SQLException: Cannot close a connection while a transaction is still > active. > at > org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source) > at org.apache.derby.client.am.SqlException.getSQLException(Unknown > Source) > at org.apache.derby.client.am.Connection.closeResourcesX(Unknown > Source) > at org.apache.derby.client.am.Connection.closeX(Unknown Source) > at org.apache.derby.client.net.NetConnection.closeX(Unknown Source) > at org.apache.derby.client.am.Connection.close(Unknown Source) > at org.apache.derby.client.net.NetConnection.close(Unknown Source) > at GetTransactionIsolation.test(GetTransactionIsolation.java:12) > at GetTransactionIsolation.main(GetTransactionIsolation.java:22) > Caused by: org.apache.derby.client.am.SqlException: Cannot close a connection > while a transaction is still active. > at > org.apache.derby.client.am.Connection.checkForTransactionInProgress(Unknown > Source) > ... 7 more -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
