db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta A. Satoor (JIRA)" <derby-...@db.apache.org>
Subject [jira] Updated: (DERBY-8) Connection object gets created with un-supported holdability on getting Connection object from XAConnection "inside" the global transaction
Date Sat, 18 Jun 2005 07:59:17 GMT
     [ http://issues.apache.org/jira/browse/DERBY-8?page=all ]

Mamta A. Satoor updated DERBY-8:
--------------------------------

    Attachment: Derby8_Derby366_061805.txt

I 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.

svn stat 
M      java\engine\org\apache\derby\iapi\jdbc\BrokeredConnection.java
M      java\engine\org\apache\derby\iapi\jdbc\BrokeredConnection30.java
M      java\testing\org\apache\derbyTesting\functionTests\tests\store\xaOffline1.sql
M      java\testing\org\apache\derbyTesting\functionTests\tests\store\xab2354.sql
M      java\testing\org\apache\derbyTesting\functionTests\tests\jdbcapi\xaAnotherTest.sql
M      java\testing\org\apache\derbyTesting\functionTests\tests\jdbcapi\xaSimplePositive.sql
M      java\testing\org\apache\derbyTesting\functionTests\tests\jdbcapi\xaSimpleNegative.sql
M      java\testing\org\apache\derbyTesting\functionTests\tests\jdbcapi\checkDataSource30.java
M      java\testing\org\apache\derbyTesting\functionTests\master\xaOffline1.out
M      java\testing\org\apache\derbyTesting\functionTests\master\xaSimplePositive.out
M      java\testing\org\apache\derbyTesting\functionTests\master\xab2354.out
M      java\testing\org\apache\derbyTesting\functionTests\master\xaSimpleNegative.out
M      java\testing\org\apache\derbyTesting\functionTests\master\xaAnotherTest.out
M      java\testing\org\apache\derbyTesting\functionTests\master\checkDataSource30.out

Kathey, may be you can try this fix with Network Server and see if it resolves any related
issues you had there?

I have run the test suite and this fix has not caused any failures. Have changed some of the
existing XA tests so that they can rely on correct holdability status inside and outside global
transaction.

If no comments from anyone, can a commiter please commit this patch?


> Connection object gets created with un-supported holdability on getting Connection object
from XAConnection "inside" the global transaction
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-8
>          URL: http://issues.apache.org/jira/browse/DERBY-8
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.0.2.0
>     Reporter: Tulika Agrawal
>     Priority: Minor
>  Attachments: Derby8_Derby366_061805.txt
>
> 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

-- 
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


Mime
View raw message