Module com.microsoft.sqlserver.jdbc
Package com.microsoft.sqlserver.jdbc

# Class SQLServerXAResource

java.lang.Object
com.microsoft.sqlserver.jdbc.SQLServerXAResource

All Implemented Interfaces:
  `XAResource`

public final class SQLServerXAResource extends Object implements XAResource
Provides an XAResource for XA distributed transaction management. XA transactions are implemented over SQL Server using Microsoft Distributed Transaction Manager (DTC). SQLServerXAResource makes calls to a SQL Server extended dll called SQLServer_XA.dll which interfaces with DTC. XA calls received by SQLServerXAResource (XA_START, XA_END, XA_PREPARE etc) are mapped to the corresponding calls to DTC functions. SQLServerXAResource may also be configured not to use DTC. In this case distributed transactions are simply implemented as local transactions.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`SSTRANSTIGHTLYCPLD`
Used to allow the tightly coupled XA transactions, which have different XA branch transaction IDs (XIDs) but have the same global transaction ID (GTRID)

### Fields inherited from interface javax.transaction.xa.XAResource

`TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY`

## Method Summary

Modifier and Type
Method
Description
`void`
`commit(Xid xid, boolean onePhase)`
`void`
`end(Xid xid, int flags)`
`void`
`forget(Xid xid)`
`int`
`getTransactionTimeout()`
`boolean`
`isSameRM(XAResource xares)`
`int`
`prepare(Xid xid)`
`Xid[]`
`recover(int flags)`
`void`
`rollback(Xid xid)`
`boolean`
`setTransactionTimeout(int seconds)`
`void`
`start(Xid xid, int flags)`
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### SSTRANSTIGHTLYCPLD

public static final int SSTRANSTIGHTLYCPLD
Used to allow the tightly coupled XA transactions, which have different XA branch transaction IDs (XIDs) but have the same global transaction ID (GTRID)

See Also:
  - Constant Field Values

## Method Details

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### start

public void start(Xid xid, int flags) throws XAException

Specified by:
  `start` in interface `XAResource`
Throws:
  `XAException`

### end

public void end(Xid xid, int flags) throws XAException

Specified by:
  `end` in interface `XAResource`
Throws:
  `XAException`

### prepare

public int prepare(Xid xid) throws XAException

Specified by:
  `prepare` in interface `XAResource`
Throws:
  `XAException`

### commit

public void commit(Xid xid, boolean onePhase) throws XAException

Specified by:
  `commit` in interface `XAResource`
Throws:
  `XAException`

### rollback

public void rollback(Xid xid) throws XAException

Specified by:
  `rollback` in interface `XAResource`
Throws:
  `XAException`

### forget

public void forget(Xid xid) throws XAException

Specified by:
  `forget` in interface `XAResource`
Throws:
  `XAException`

### recover

public Xid[] recover(int flags) throws XAException

Specified by:
  `recover` in interface `XAResource`
Throws:
  `XAException`

### isSameRM

public boolean isSameRM(XAResource xares) throws XAException

Specified by:
  `isSameRM` in interface `XAResource`
Throws:
  `XAException`

### setTransactionTimeout

public boolean setTransactionTimeout(int seconds) throws XAException

Specified by:
  `setTransactionTimeout` in interface `XAResource`
Throws:
  `XAException`

### getTransactionTimeout

public int getTransactionTimeout() throws XAException

Specified by:
  `getTransactionTimeout` in interface `XAResource`
Throws:
  `XAException`