[ http://nagoya.apache.org/jira/browse/DERBY-8?page=comments#action_56026 ] Shreyas Kaushik commented on DERBY-8: -------------------------------------
My comments on this issue: Both the XAResource and the Connection handle got by calling a getConnection() method on a XAConnection are child entities of the XAConnection. So the XAResource and the Connection are in parallel if a hierarchy is imagined with a XAConnection as the head. So the Connection handle got by calling a getConnection method on the XAResource is not bound to have the same holdability for cursors as that of the Transaction. It should have its own holdability state. Moreover in a managed sscenario the XAConnection interface is not directly used, we just get a java.sql.Connection handle by calling the getConnection method on the DataSource. It is the DataSource configuration that determines what all happens behind the scene to return a Connection handle. So in my opinion Derby is behaving properly. > Connection object gets created with un-supported holdability on getting > Connection object from XAConnection "inside" the global transaction > ------------------------------------------------------------------------------------------------------------------------------------------- > > Key: DERBY-8 > URL: http://nagoya.apache.org/jira/browse/DERBY-8 > Project: Derby > Type: Bug > Components: JDBC > Versions: 10.0.2.0 > Reporter: Tulika Agrawal > Priority: Minor > > 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://nagoya.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira
