Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
DB XA Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

5.4 DB2 CLI Access Module

This section describes how to use the DB2 CLI Access Module with XA functionality. This chapter assumes that you have followed the instructions for installing and building the DB XA Module with DB2 CLI. These instructions are located in Appendix A, "Installing and Building the DB XA Module," of the manual Installing and Building Your SourcePro C++ Products.

5.4.1 Configuring the Resource Manager

As explained in Chapter 4, XA connections to your database are established by using the database() function in RWDBManager, and providing its propertyString parameter with key XA=xaParameter. This section explains how you obtain the DB2-specific value of the xaParameter argument.

When you run on DB2, the value of the xaParameter argument must be the same as that used for the database alias parameter in the open string passed to the TPM to open the database. The open string for the DB2 database takes the following form:


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

The parameters for the DB2 open string include:

In addition to the above parameters, other parameters like TPM, AXLIB, CHAIN_END, SUSPEND_CURSOR, and HOLD_CURSOR can also be provided in the open string for DB2 version 7 and above. For the explanation of these parameters, please refer to section, "Setting Up a Database as a Resource Manager," in the Administration Guide for DB2 UDB, provided by DB2.

5.4.2 Switch Table

The XA interface describes a structure called the switch table, which lists the names of the xa_ routines implemented in the resource manager. This structure is called xa_switch_t, and is defined in the xa.h header file. The switch table helps build servers that are truly independent of the database vendor being used.

In order to be integrated in the X/Open environment, each resource manager must define the name of its XA switch table. The DB2 UDB specific xa_switch_t table is accessible through the variable db2xa_switch. You can use the following DB XA method to access the switch table in a database-independent manner:

static void* RWDBManager::xaSwitch(const RWCString& accessLib)

Note that the method RWDBManager::xaSwitch(const RWCString&) returns a void*. This return value must be cast to a struct xa_switch_t pointer.

5.4.3 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 transaction processing monitor (TPM).

5.4.3.1 RWDBDatabase Objects

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

RWDBDatabase RWDBManager::database("accessLib", "", "", "", "", "XA=dbAlias");

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

accessLib

propertyString or "XA=dbAlias"

5.4.4 The Contents of RWDBSystemHandle

The DB XA Module does not differ from the DB Interface Module in its approach to using RWDBSystemHandle. For information about the DB2 CLI-specific implementations of this class, see the DB2 CLI Access Module User's Guide.


RWDBSystemHandle gives you access to vendor library-specific structures.There are complications associated with making direct DB2 CLI calls. We recommend that you always consult your DB2 CLI manual, since there are many calls that are restricted in an XA environment.

5.4.5 The Contents of RWDBEnvironmentHandle

The DB XA Module returns an environment handle of type RWDBDB2CLILibXAEnvironmentHandle. This handle derives from RWDBDB2CLILibEnvironmentHandle and redefines the behavior of the following methods:



Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.