XAResourcepublic class AS400JDBCXAResource extends Object implements XAResource
This support is only available when connecting to systems running OS/400 V5R1 or later, or IBM i.
The following example creates an AS400JDBCXAResource object that can be used to work with the XA resource manager.
// Create an XA data source for making the XA connection.
AS400JDBCXADataSource xaDataSource = new AS400JDBCXADataSource("myAS400");
xaDataSource.setUser("myUser");
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();
AS400JDBCXAConnection,
AS400JDBCXADataSourceTMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY| Modifier and Type | Method | Description |
|---|---|---|
void |
commit(Xid xid,
boolean onePhase) |
Commits a global transaction.
|
void |
end(Xid xid,
int flags) |
Ends the work performed on behalf of a transaction branch.
|
void |
forget(Xid xid) |
Tells the resource manager to forget about a heuristically completed
transaction branch.
|
int |
getTransactionTimeout() |
Returns the current transaction timeout value.
|
boolean |
isSameRM(XAResource xaResource) |
Indicates if the resource manager represented by this XA resource
is the same resource manager represented by the specified XA resource.
|
int |
prepare(Xid xid) |
Prepares for a transaction commit.
|
Xid[] |
recover(int flags) |
Recovers a list of prepared transaction branches from the
resource manager.
|
void |
rollback(Xid xid) |
Rolls back a transaction branch.
|
void |
setLockWait(int lockWait) |
Specifies the number of seconds that the system will wait on any lock request during this transaction.
|
boolean |
setTransactionTimeout(int transactionTimeout) |
Sets the current transaction timeout value.
|
void |
start(Xid xid,
int flags) |
Starts the work on behalf of a transaction branch.
|
String |
toString() |
Returns the string representation of the XA resource.
|
public void commit(Xid xid, boolean onePhase) throws XAException
commit in interface XAResourcexid - The global transaction identifier.onePhase - true if the resource manager should use a one-phase
commit protocol to commit the work; false otherwise.XAException - If an error occurs.public void end(Xid xid, int flags) throws XAException
end in interface XAResourcexid - The global transaction identifier. This must correspond
to the global transaction identifier previously passed
to start().flags - The flags. Possible values are:
XAException - If an error occurs.public void forget(Xid xid) throws XAException
forget in interface XAResourcexid - The global transaction identifier.XAException - If an error occurs.public int getTransactionTimeout()
throws XAException
getTransactionTimeout in interface XAResourceXAException - If an error occurs.public boolean isSameRM(XAResource xaResource) throws XAException
isSameRM in interface XAResourcexaResource - The XA resource.XAException - If an error occurs.public int prepare(Xid xid) throws XAException
prepare in interface XAResourcexid - The global transaction identifier.XAException - If an error occurs.public Xid[] recover(int flags) throws XAException
recover in interface XAResourceflags - The flags. Possible values are:
XAException - If an error occurs.public void rollback(Xid xid) throws XAException
rollback in interface XAResourcexid - The global transaction identifier.XAException - If an error occurs.public boolean setTransactionTimeout(int transactionTimeout)
throws XAException
setTransactionTimeout in interface XAResourcetransactionTimeout - The current transaction timeout value in seconds,
or 0 to reset the timeout value to the default. The transaction timeout
will be set the next time start() is called.XAException - If an error occurs.public void start(Xid xid, int flags) throws XAException
start in interface XAResourcexid - The global transaction identifier.flags - The flags. Possible values are:
XAException - If an error occurs.public void setLockWait(int lockWait)
throws SQLException
lockWait - The time in seconds to wait.SQLException - If a database error occurs.Copyright © 2024. All rights reserved.