You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Kathey Marsden <km...@sbcglobal.net> on 2009/04/01 20:08:15 UTC

XAException.errorCode on XAException caused by an SQLException

When an XAException occurs during xa.start() or other XA operation, 
because of an SQLException, what should the XAException.errorCode be?  
Currently we have an errorCode of 0, regardless of the severity.  Is 
this correct, or should it be XAER_RMERR for SESSION_SEVERITY exceptions 
or all SQLExceptions?

Here is an example where we get no current connection on xa.start() 
after shutting down the database.  (I informed the user that shutting 
down the database in the midst of normal operations is not a good idea 
as it may lead to NullPointerExceptions and other strange behavior on 
other calls). They are, however, wondering about whether we should ever 
see an errorCode 0 on an XAException.

Thanks

Kathey

[C:] java NoConnRepro
connectionClosed called from MyConnectionEventListner
No exception to display
Start shutdown
Shutdown complete
XAException errorCode=0
javax.transaction.xa.XAException: No current connection.
        at 
org.apache.derby.jdbc.EmbedXAResource.wrapInXAException(Unknown Source)
        at org.apache.derby.jdbc.EmbedXAResource.start(Unknown Source)
        at NoConnRepro.main(NoConnRepro.java:33)
Caused by: java.sql.SQLNonTransientConnectionException: No current 
connection.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
Source)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
Source)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
Source)
        at org.apache.derby.impl.jdbc.Util.noCurrentConnection(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.EmbedConnection.checkIfClosed(Unknown Source)
        at 
org.apache.derby.impl.jdbc.EmbedConnection.setupContextStack(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedConnection.rollback(Unknown 
Source)
        at 
org.apache.derby.jdbc.EmbedPooledConnection.resetRealConnection(Unknown 
Source)
        ... 2 more
Caused by: java.sql.SQLException: No current connection.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown 
Source)
        ... 10 more











Re: XAException.errorCode on XAException caused by an SQLException

Posted by Kathey Marsden <km...@sbcglobal.net>.
Kathey Marsden wrote:
> When an XAException occurs during xa.start() or other XA operation, 
> because of an SQLException, what should the XAException.errorCode be?  
> Currently we have an errorCode of 0, regardless of the severity.  Is 
> this correct, or should it be XAER_RMERR for SESSION_SEVERITY 
> exceptions or all SQLExceptions?
Looking more closely at the spec, I would suggest XAER_RMFAIL for 
SESSION_SEVERITY or greater and XAER_RMERR for lower severity exceptiosn.

XAER_RMERR is described as:
A resource manager error has occurred in the transaction branch.

XAER_RMFAIL is described as:
Resource manager is unavailable.

Please let me know opinions. If I don't hear anything I'll file an issue 
tomorrow to change it.

Thanks

Kathey