Databases and Connections

The DB XA Module does not open connections to a database server. Instead, it makes use of connections previously opened by the TPM. When the TPM opens a connection to the Sybase SQL Server database, a CS_CONNECTION structure gets allocated. Therefore, the DB XA Module does not use Sybase Open Client Client-Library calls like the following, because these calls explicitly establish connections to database servers:

 

ct_close

ct_con_alloc

ct_con_drop

ct_con_props(with certain options)

ct_config

(for details, see the XA Interface Integration Guide for CICS, Encina and Tuxedo)

ct_connect

ct_exit

ct_getloginfo

ct_init

ct_options

(for details, see the XA Interface Integration Guide for CICS, Encina and Tuxedo)

ct_remote_pwd

ct_setloginfo

Consult your Sybase and TPM documentation for complete and up-to-date information.

The connection handle is obtained using the logical resource manager (LRM) name provided during the configuration of the resource manager. The DB XA Module uses a global CS_CONTEXT for all database calls. It fetches the CS_CONNECTION object that was allocated by the TPM using the lrm_name and the thread information, in case the build is multithreaded. For more information about the LRM, see the XA Interface Integration Guide for CICS, Encina and Tuxedo.

RWDBDatabase Objects

In order for the DB XA Module to interact with a resource manager to establish connectivity to a database, you must create an instance of RWDBDatabase by calling:

 

RWDBManager::database("accessLib", "", "", "", "", "XA=lrm_name");

All arguments are of type RWCString. Note that establishing an XA connection to the Sybase database requires only two of the six database() arguments, as described here:

accessLib

The argument for the first parameter is the same as that which you provide for the non-XA connection.

For static libraries, supply the string "SYBASE_CT".

For shared libraries, supply the name of your shared access library, for example "libct<ver>8d.so".

propertyString or "XA=lrm_name"

The argument for the sixth and last parameter, propertyString, provides the lrm_name specified in the XA configuration file. This LRM name should be the same as the lrm_name parameter that you provided in the open string while registering with the TPM. For more information, see Configuring the Resource Manager.

RWDBConnection Objects

When using the DB XA Module, RWDBConnection objects are created in the same manner as those in the non-XA environment. Given an RWDBDatabase object:

 

RWDBDatabase dbase=RWDBManager::database("accessLib", "", "", "",

"", "lrm_name");

RWDBConnection conn=dbase.connection();

The same rules that apply to default connections in a non-XA environment apply in the XA environment. (See the “Databases and Connections” section of the DB Interface Module User’s Guide.)

The DB XA Module does not pose any restrictions on the number of connections opened on a single lrm_name. The restriction is placed by the CS_MAX_CONNECT property in the [all] section of the XA configuration file.

Because the retrieval of CS_CONNECTION objects is dependent on the current thread information, connection pooling is turned off when using the DB XA Module with the Sybase Access Module.

Using method RWDBDatabase:: defaultConnections(size_t size) to set default connections in a connection pool will result in a notSupported error.

Because the TPM actually opens and closes connections, we recommend that you always use explicit connections.