Issue Details (XML | Word | Printable)

Key: DERBY-8
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Mamta A. Satoor
Reporter: Tulika Agrawal
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

Created: 28/Sep/04 01:00 AM   Updated: 12/Apr/06 02:26 AM
Return to search
Component/s: JDBC
Affects Version/s: 10.0.2.0
Fix Version/s: 10.1.1.0, 10.2.1.6

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works Derby8_Derby366_061805.txt 2005-06-18 04:54 PM Mamta A. Satoor 33 kB
Issue Links:
Duplicate
 

Resolution Date: 12/Apr/06 02:26 AM


 Description  « Hide
Reporting for Mamta Satoor, filed on Derby-dev list.

I think there is a bug in Derby when the user code tries to get the
Connection object from XAConnection "inside" the global transaction.
In this case, the Connection object gets created with un-supported
holdability. Look at the following piece of code and it's output to
see what exactly happens
    EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
    dscsx.setDatabaseName("wombat");
    XAConnection xac = dscsx.getXAConnection("fred", "wilma");
    XAResource xr = xac.getXAResource();
    xid = getXid(27, (byte) 21, (byte) 01);
    xr.start(xid, XAResource.TMNOFLAGS);
    conn1 = xac.getConnection();
    System.out.println("This is a bug. Connection's holdability should
have been CLOSE_CURSORS_AT_COMMIT since it is in the global
transaction");
    System.out.println("CONNECTION(in xa transaction) HOLDABILITY " +
(conn1.getHoldability() == ResultSet.HOLD_CURSORS_OVER_COMMIT));
    System.out.println("Autocommit on Connection inside global
transaction has been set correctly to " + conn1.getAutoCommit());
    xr.end(xid, XAResource.TMSUCCESS);
The output for the above piece of code is
    This is a bug. Connection's holdability should have been
CLOSE_CURSORS_AT_COMMIT since it is in the global transaction
    CONNECTION(in xa transaction) HOLDABILITY true
    Autocommit on Connection inside global transaction has been set
correctly to false


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #191755 Wed Jun 22 03:02:54 UTC 2005 kmarsden Fix for
DERBY-8
Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction

DERBY-366
In jdk13, when a connection transitions from global transaction to local transaction, its default holdability of HOLD_CURSORS_OVER_COMMIT is not restored.


 have a patch to fix DERBY-8 (Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction) and DERBY-366 (In jdk13, when a connection transitions from global transaction to local transaction, its default holdability of HOLD_CURSORS_OVER_COMMIT is not restored.) The patch is attached to both DERBY-8 and DERBY-366.

The fix for both these bugs was centered around fixing the holdability handling in BrokeredConnection.java This was because BrokeredConnection.java had no code for restoring the holdability of real connection object and no code for saving the current holdability state of real connection object. I put fix for both these issues in BrokeredConnection.java so that both jdk13 and jdk14+ environments will be handled correctly. Had to use reflection for this holdability work
because Connection.setHoldability and Connection.getHoldability methods are not available through JDK13 apis.

Contributed by Mamta Satoor
Files Changed
MODIFY /incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/xab2354.sql
MODIFY /incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/xaSimpleNegative.out
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/xaAnotherTest.sql
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dataSourcePermissions_net.java
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/xab2354.out
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/xaSimplePositive.out
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/xaSimpleNegative.sql
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/xaAnotherTest.out
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/xaOffline1.out
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/xaSimplePositive.sql
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/xaOffline1.sql
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource30.java

Repository Revision Date User Message
ASF #192968 Wed Jun 22 18:09:01 UTC 2005 kmarsden Replace abbreviated test netxaPositive with xaSimplePositive in the derbynetclientmats suite. Tests fix for DERBY-346 which was actually fixed by Mamta's fix of DERBY-8
Files Changed
ADD /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/xaSimplePositive.out
DEL /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/netxaPositive_sed.properties
DEL /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/netxaPositive_app.properties
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall
MODIFY /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant
DEL /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/netxaPositive.sql

Repository Revision Date User Message
ASF #208776 Fri Jul 01 17:28:49 UTC 2005 fuzzylogic In preperation for the 10.1 release, roll up fixes from trunk.

Includes fixes for DERBY-8, DERBY-247, DERBY-276, DERBY-348, DERBY-354,
DERBY-361, DERBY-366, DERBY-389, DERBY-405, DERBY-416, and DERBY-420
Files Changed
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/synonym.out
ADD /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/j9_13/updatableResultSet.out (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_13/updatableResultSet.out)
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/synonym.out
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/xaSimpleNegative.sql
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/store/xab2354.sql
ADD /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/j9_13/caseI_tr_TR.out (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_13/caseI_tr_TR.out)
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/xaSimplePositive.out
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/store/xaOffline1.sql
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/tools/iepnegativetests.sql
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/scrollCursors2.java
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/BaseContainer.java
ADD /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/store/oc_rec3.java (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/oc_rec3.java)
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/xaAnotherTest.out
MODIFY /incubator/derby/code/branches/10.1/tools/javadoc/publishedapi.ant
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/iepnegativetests_ES.out
MODIFY /incubator/derby/code/branches/10.1/java/demo/simple/example.html
MODIFY /incubator/derby/code/branches/10.1/java/tools/org/apache/derby/impl/tools/ij/utilMain.java
DEL /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/netxaPositive_sed.properties
MODIFY /incubator/derby/code/branches/10.1/java/client/org/apache/derby/client/am/ResultSet.java
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/updatableResultSet.out
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/loc/messages_en.properties
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ieptests.sql
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
MODIFY /incubator/derby/code/branches/10.1/build.xml
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/xaOffline1.out
ADD /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/xaSimplePositive.out (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/xaSimplePositive.out)
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/iepnegativetests.out
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/diag/ErrorMessages.java
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ieptests.out
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java
ADD /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/errorStream_app.properties (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/errorStream_app.properties)
ADD /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/store/oc_rec4.java (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/oc_rec4.java)
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
ADD /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/oc_rec1.out (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/oc_rec1.out)
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java
ADD /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/oc_rec2.out (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/oc_rec2.out)
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/xaAnotherTest.sql
ADD /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/oc_rec3.out (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/oc_rec3.out)
ADD /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/oc_rec4.out (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/oc_rec4.out)
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/scrollCursors1.out
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/store/BaseTest.java
ADD /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14 (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14)
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/synonym.sql
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/jdk14/updatableResultSet.out
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/impl/load/ColumnInfo.java
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/I18NImportExport.sql
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/ieptests.out
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/xab2354.out
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/scrollCursors1.out
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/xaSimpleNegative.out
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/xaSimplePositive.sql
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/suites/storerecovery.runall
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/impl/load/ExportResultSetForObject.java
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/UnicodeEscape_JP.sql
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/synonym.out
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/scrollCursors1.out
ADD /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/store/oc_rec1.java (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/oc_rec1.java)
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ver2.6/parameterMapping.out
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/scrollCursors1.sql
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/AllocPage.java
MODIFY /incubator/derby/code/branches/10.1/STATUS
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/impl/load/Import.java
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/AllocExtent.java
REPLACE /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out)
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ieptests.out
DEL /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/netxaPositive.sql
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/CompressSpacePageOperation.java
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/I18NImportExport.out
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall
DEL /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/netxaPositive_app.properties
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/PhysicalUndoOperation.java
ADD /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/store/oc_rec2.java (from /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/oc_rec2.java)
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource30.java
MODIFY /incubator/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/UnicodeEscape_JP.out
MODIFY /incubator/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java