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. Therefore, the DB XA Module does not make use of Oracle OCI calls such as OCIServerAttach(), OCISessionBegin() and OCISessionEnd(), since those calls explicitly establish connections to database servers.

To obtain a valid environment handle and service context handle, the DB XA Module uses function calls xaoEnv() and xaoSvcCtx(), respectively, for a connection previously opened by the TPM. The signatures for these routines are:

 

OCIEnv *xaoEnv(text *dbname)

OCISvcCtx *xaoSvcCtx(text *dbname)

The dbname parameter has the same value as the xaParameter argument that you pass in as the propertyString parameter for RWDBManager::database(). That is, function xaoEnv returns the environment handle, already allocated by the TPM, that corresponds to the dbName parameter. Likewise, function xaoSvcCtx returns the service context handle, already allocated by the TPM, that corresponds to the dbName parameter. If dbname is a null pointer, these functions respectively return environment and service context handles for the default connection.

RWDBDatabase Objects

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

 

RWDBManager::database("accessLib", "", "", "", "",

"XA=xaParameter");

All arguments are of type RWCString. Note that establishing an XA connection to the Oracle OCI 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 "ORACLE_OCI".

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

propertyString or "XA=xaParameter"

The argument for the sixth and last parameter, propertyString, provides the database name, passed as XA=xaParameter. Oracle OCI identifies each XA application by its database name. This database name should be the same as the value of the DB parameter, which you provided in the open string while registering with the TPM (see Configuring the Resource Manager).