Connection pooling  Restrictions on and interpretations of JDBC standards

Chapter 2: Programming Information

Distributed transaction management support

This feature provides a standard Java API for performing distributed transactions with either Adaptive Server version 12.x or version 11.x with XA-Server.

NoteThis feature is designed for use in a large multitier environment.


Reference

See Chapter 7, “Distributed Transactions,” in the JDBC 2.0 Optional Package (formerly the JDBC 2.0 Standard Extension API).


Related interfaces


Background and system requirements

For Adaptive Server 12.0 and later

Figure 2-2: Distributed transaction management support with version 12.x

For Adaptive Server 11.x

jConnect also provides a standard Java API for performing distributed transactions with Adaptive Server version 11.x as your database server.


Adaptive Server 12.x use

Configuration by administrator: LDAP

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

Access by middle-tier clients

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");

Adaptive Server 11.x use

Configuration by administrator: LDAP

This approach is the same as “1a. Configuration by administrator: LDAP”described in “JNDI for naming databases”, except that you enter an additional three lines to the LDIF entry.

In the following example, the additional code lines are 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.16:userconnection
1.3.6.1.4.1.897:4.2.17:1
1.3.6.1.4.1.897.4.2.18:XADataSource

where . . .4.2.17:1 indicates that jConnect is going to connect to an XA-Server and userconnection corresponds to the Logical Resource Manager (LRM) to use. XA-Server has an xa_config file that contains these entries:

[xa]
lrm=userconnection
server=my_ase_11_server
XAServer=my_xa_server

Figure 2-4: Distributed transaction management support sample configuration

See the XA-Server documentation for details on how to write an xa_config file.

Access by middle-tier clients

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();

With Adaptive Server 11.x, you cannot override the default user name and password­; that is, you cannot call:

xads.getXAConnection("my_username","my_password");

because the lrm is associated with a specific user name and password.





Copyright © 2003. Sybase Inc. All rights reserved. Restrictions on and interpretations of JDBC standards

View this book as PDF