public class AS400JDBCXAConnection extends AS400JDBCPooledConnection implements javax.sql.XAConnection
Because transaction boundaries are controlled by a transaction manager, the caller cannot explicitly commit or rollback on connections pooled by this object. In addition, auto commit is initialized to false and cannot be set to true.
This support is only available when connecting to systems running OS/400 V5R1 or later, or IBM i.
The following example creates an AS400JDBCXAConnection object that can be used to manage XA transactions.
// Create an XA data source for making the XA connection. AS400JDBCXADataSource xaDataSource = new AS400JDBCXADataSource("myAS400"); xaDataSource.setUser("muUser"); xaDataSource.setPassword("myPasswd"); // Get an XAConnection and get the associated XAResource. // This provides access to the resource manager. XAConnection xaConnection = xaDataSource.getXAConnection(); XAResource xaResource = xaConnection.getXAResource(); // ... work with the XA resource. // Close the XA connection when done. This implicitly // closes the XA resource. xaConnection.close();
AS400JDBCXADataSource
,
AS400JDBCXAResource
Modifier and Type | Method and Description |
---|---|
javax.transaction.xa.XAResource |
getXAResource()
Returns the XA resource associated with this connection.
|
addConnectionEventListener, close, closeAll, equals, getConnection, getInactivityTime, getInUseTime, getLifeSpan, getUseCount, hashCode, isInUse, removeConnectionEventListener
public javax.transaction.xa.XAResource getXAResource() throws java.sql.SQLException
getXAResource
in interface javax.sql.XAConnection
java.sql.SQLException
- If an error occurs.