This feature provides a standard Java API for performing distributed transactions with either Adaptive Server.
This feature is designed for use in a large multitier environment.
See Chapter 7, “Distributed Transactions,” in the JDBC 2.0 Optional Package (formerly the JDBC 2.0 Standard Extension API).
javax.sql.XADataSource
javax.sql.XAConnection
javax.transaction.xa.XAResource
Because jConnect is communicating directly with the resource manager within Sybase Adaptive Server version 12.0 and later, the installation must have Distributed Transaction Management support.
Any user who wants to participate in a distributed transaction must have the “dtm_tm_role” granted, or the transactions fail.
To use distributed transactions, you must install the stored procedures in the /sp directory. Refer to “Installing Stored Procedures” in Chapter 1 of the jConnect for JDBC Installation Guide.
Figure 2-2: Distributed transaction management support with version 12.x
This approach is the same as “1a. Configuration by administrator: LDAP” described in “JNDI for naming databases”, except that you enter an additional line to the LDIF entry. In the following example, the added line of code is displayed in bold.
dn:servername:myASE, o=MyCompany, c=US 1.3.6.1.4.1.897.4.2.5:TCP#1# mymachine 4000 1.3.6.1.4.1.897.4.2.10:PACKETSIZE=1024&user=me&password=secret 1.3.6.1.4.1.897.4.2.11:userdb 1.3.6.1.4.1.897.4.2.18:XADataSource
This procedure initializes three properties (INITIAL_CONTEXT_FACTORY, PROVIDER_URL, and OBJECT_FACTORIES), and retrieves a XADataSource object. For example:
... XADataSource xads = (XADatasource) ctx.lookup("servername=myASE"); XAConnection xaconn = xads.getXAConnection();
or override the default settings for the user name and password:
... XADataSource xads = (XADatasource) ctx.lookup("servername=myASE"); XAConnection xaconn = xads.getXAConnection("my_username","my_password");