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)
For static libraries, you must supply the string
"DB2CLI" to the
xaSwitch() function.
For example:
(struct xa_switch_t*)RWDBManager::xaSwitch("DB2CLI")
For shared libraries, you must supply the name of the access library, using the same name as the non-XA library.
For example:
(struct xa_switch_t *)RWDBManager::xaSwitch("libdb2<ver>12d.so")
Note that the method RWDBManager::xaSwitch(const RWCString&) returns a void*. This return value must be cast to a struct xa_switch_t pointer.