com.microsoft.sqlserver.jdbc

## Class SQLServerXADataSource

- java.lang.Object
- - com.microsoft.sqlserver.jdbc.SQLServerDataSource
  - - com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource
    - - com.microsoft.sqlserver.jdbc.SQLServerXADataSource

All Implemented Interfaces:
  ISQLServerDataSource, Serializable, Wrapper, Referenceable, CommonDataSource, ConnectionPoolDataSource, DataSource, XADataSource

    public final class SQLServerXADataSource
    extends SQLServerConnectionPoolDataSource
    implements XADataSource

SQLServerXADataSource provides database connections for use in distributed (XA) transactions. SQLServerXADataSource also supports connection pooling of physical connections. The XADataSource and XAConnection interfaces, which are defined in the package javax.sql, are implemented by sqlserver. An XAConnection object is a pooled connection that can participate in a distributed transaction. More precisely, XAConnection extends the PooledConnection interface by adding the method getXAResource. This method produces an XAResource object that can be used by a transaction manager to coordinate the work done on this connection with the other participants in the distributed transaction.

Because they extend the PooledConnection interface, XAConnection objects support all the methods of PooledConnection objects. They are reusable physical connections to an underlying data source and produce logical connection handles that can be passed back to a JDBC application.

XAConnection objects are produced by an XADataSource object. There is some similarity between ConnectionPoolDataSource objects and XADataSource objects in that they are both implemented below a DataSource layer that is visible to the JDBC application. This architecture allows sqlserver to support distributed transactions in a way that is transparent to the application.
SQLServerXADataSource can be configured to integrate with Microsoft Distributed Transaction Coordinator (DTC) to provide true, distributed transaction processing.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`SQLServerXADataSource()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Reference` `getReference()`
`XAConnection` `getXAConnection()` Obtain a physical database connection to particate in an XA transaction.
`XAConnection` `getXAConnection(String user, String password)` Obtain a physical database connection to particate in an XA transaction with the specified user and password.

### Methods inherited from class com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource

`getPooledConnection, getPooledConnection`

### Methods inherited from class com.microsoft.sqlserver.jdbc.SQLServerDataSource

`getAccessToken, getApplicationIntent, getApplicationName, getAuthentication, getColumnEncryptionSetting, getConnection, getConnection, getDatabaseName, getDescription, getEnablePrepareOnFirstPreparedStatementCall, getEncrypt, getFailoverPartner, getFIPS, getFIPSProvider, getGSSCredentials, getHostNameInCertificate, getInstanceName, getKeyStoreAuthentication, getKeyStoreLocation, getLastUpdateCount, getLockTimeout, getLoginTimeout, getLogWriter, getMultiSubnetFailover, getPacketSize, getParentLogger, getPortNumber, getQueryTimeout, getResponseBuffering, getSelectMethod, getSendStringParametersAsUnicode, getSendTimeAsDatetime, getServerName, getServerNameAsACE, getServerPreparedStatementDiscardThreshold, getServerSpn, getSocketTimeout, getTransparentNetworkIPResolution, getTrustServerCertificate, getTrustStore, getTrustStoreType, getURL, getUser, getWorkstationID, getXopenStates, isWrapperFor, setAccessToken, setApplicationIntent, setApplicationName, setAuthentication, setAuthenticationScheme, setColumnEncryptionSetting, setDatabaseName, setDescription, setEnablePrepareOnFirstPreparedStatementCall, setEncrypt, setFailoverPartner, setFIPS, setFIPSProvider, setGSSCredentials, setHostNameInCertificate, setInstanceName, setIntegratedSecurity, setKeyStoreAuthentication, setKeyStoreLocation, setKeyStoreSecret, setLastUpdateCount, setLockTimeout, setLoginTimeout, setLogWriter, setMultiSubnetFailover, setPacketSize, setPassword, setPortNumber, setQueryTimeout, setResponseBuffering, setSelectMethod, setSendStringParametersAsUnicode, setSendTimeAsDatetime, setServerName, setServerNameAsACE, setServerPreparedStatementDiscardThreshold, setServerSpn, setSocketTimeout, setTransparentNetworkIPResolution, setTrustServerCertificate, setTrustStore, setTrustStorePassword, setTrustStoreType, setURL, setUser, setWorkstationID, setXopenStates, toString, unwrap`

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

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

### Methods inherited from interface javax.sql.CommonDataSource

`getLoginTimeout, getLogWriter, getParentLogger, setLoginTimeout, setLogWriter`

### Constructor Detail

#### SQLServerXADataSource

    public SQLServerXADataSource()

### Method Detail

#### getXAConnection

    public XAConnection getXAConnection(String user,
                                        String password)
                                 throws SQLException

Obtain a physical database connection to particate in an XA transaction with the specified user and password. This API should only be called by XA connection pool implementations, not regular JDBC application code.

Specified by:
  `getXAConnection` in interface `XADataSource`
Returns:
  A new XAConnection
Throws:
  `SQLException` - The database connection failed.

#### getXAConnection

    public XAConnection getXAConnection()
                                 throws SQLException

Obtain a physical database connection to particate in an XA transaction. This API should only be called by XA connection pool implementations, not regular JDBC application code.

Specified by:
  `getXAConnection` in interface `XADataSource`
Returns:
  A new XAConnection
Throws:
  `SQLException` - The database connection failed.

#### getReference

    public Reference getReference()

Specified by:
  `getReference` in interface `Referenceable`
Overrides:
  `getReference` in class `SQLServerConnectionPoolDataSource`