Creating XA resources

You must configure XA resources to access a specific database. XA resources differ from connection caches in that XA resources are XA-Library interfaces that maintain their own connection pool separate from the connection cache connection pool.

If a get connection call (such as the Java getConnection method call) is in a transaction, the XA resource is automatically used to return a connection. If a get connection call is not in a transaction, the connection cache is automatically used. If the transactional behavior for a component uses the Supported option, then EJB Server determines at runtime whether the component executes its get connection calls in a transaction; if it does, you must configure both a connection cache and a corresponding XA resource for a database.

If you execute a transaction without an XA resource configured for a database, the EJB Server connection manager returns CS_FAIL.

By default, EJB Server uses the XA resource library for the JDBC connection: com.sybase.jdbc2.jdbc.SybXADataSource. You can also use these shared libraries or DLLs to obtain an XA resource that is exported from the database connection libraries:

Connection library

Shared library

DLL

Sybase Client Library 11.0

libjxa.so

libjxa.dll

Oracle OCI 7.x

libclntsh.so

xa73.dll

Oracle OCI 8.x

libclntsh.so

xa80.dll

To change the shared library or DLL, edit the connection cache properties file %SYBASE%\%SYBASE_EJB%Repository\ConnCache\ <cache_name>.props. For example, to instruct EJB Server to use oraclient8.dll instead of xa80.dll for Oracle OCI 8.1.x, add this line to the connection cache properties file:

com.sybase.jaguar.conncache.xadllname = oraclient8.dll

NoteYou must install XA resources in an EJB Server before components in that server can access the XA resources. You must refresh XA resources or refresh the server using View | Refresh All in the Adaptive Server plug-in, or restart the server before any changes to the list of installed XA resources or to XA resource properties take effect.

If a configured XA resource is not running or cannot be connected to, the EJB Server cannot initialize. Copy an uncorrupted version of the $SYBASE/$SYBASE_EJB/config/afconfig.dat file back into the release area and reconfiguring XA resources. See “To enable EJB Server for OTS/XA transactions:”.

StepsTo create OTS/XA transactions for XA resources:

See Table 10-5 for a description of the XA properties you enter when you create an OTS/XA transaction resource.

  1. Double-click the XA Resources folder.

  2. Double-click the Add an XA resource icon in the right side of the window.

    The Add an XA Resource wizard displays.

  3. Enter a name and description of the XA resource. Press Next.

  4. Enter the server name, a user name, and a password in the Database Connection Information window. Press Next.

  5. Enter a dll or class name in the Connectivity Information window. Press Next.

  6. Enter a database name, a default string, an open string, and a close string in the XA Driver Information window.

    NoteIf the Open String is set incorrectly, the EJB Server does not initialize.

    Press Finish.

Table 10-5: XA resource properties

Property

Description

Name

A name for the XA resource.

Description

A brief phrase describing the purpose of the XA resource.

Server Name

Name of the XA resource server for shared memory. Enter: NetworkProtocol=shm:Server=null:Port=0

User Name

A name you can use to access the server.

Password

The password for the user.

DLL or Class Name

The file name of the XA resource library. Enter: com.sybase.jdbc2.jdbc.SybXADataSource

Database Name

If you selected CT-LIB, OCI 7.x, or 8.x, specify the database name.

Default String

The string used to connect to the XA resource. You cannot modify this string, which is automatically built from the information that you entered in the previous tabs.

Open String

In this optional field, you can specify any valid open string options. For example, for a Sybase Client-Library 11.0 XA resource, you can enter:

-L logfile

where logfile is where you want to store log information.

Close String

In this optional field, you can specify a value used by the resource to close a connection.

See your XA resource documentation for more information about the Open Suffix and Close String syntax