[
https://issues.apache.org/jira/browse/DERBY-2420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502380
]
Julius Stroffek commented on DERBY-2420:
----------------------------------------
The field member 'inUnitOfWork_' in org.apache.derby.client.am.Connection is
not maintained correctly for XA transactions.
The following code does not throw any exception for client and embedded drivers
(but it should throw):
xaResource = xaConnection.getXAResource();
xaResource.start(xid, XAResource.TMNOFLAGS);
xaConnection.close();
While if we execute some queries in unit of work and will try to close the
connection afterwards, the close will fail even if the transaction would be
disassociated from the connection (calling XAResource.end). It should be
allowed to close the connection if there is no transaction associated.
If the exception is thrown client driver throws exception:
java.sql.SQLException: Cannot close a connection while a
transaction is still active.
while embedded driver throws
java.sql.SQLException: Invalid transaction state.
I would say that the exception thrown should be the same. I'll would prefer the
first one since it explaines better what is going on.
> XAConnection close method should throw an exception if it is called when the
> global transaction is associated with the connection.
> ----------------------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-2420
> URL: https://issues.apache.org/jira/browse/DERBY-2420
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Reporter: Julius Stroffek
> Assignee: Julius Stroffek
> Priority: Minor
>
> As comments show in DERBY-2220 The Distributed Transaction Processing: The XA
> Specification forbids for a transaction manager or an application to call
> XAConnection.close method when there is a global transaction associated with
> the XA connection.
> Currently,
> Embedded driver throws the exception but the connection is left in a state
> when it cannot be used anymore and the locks held by the transaction can not
> be released later.
> Network driver allows the call of the method and closes the connection.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.