Switch Table
The XA interface describes a structure called a 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. For all supported Oracle versions, the database-specific xa_switch_t table for static registration is xaosw. The DB XA Module does not support dynamic registration, as provided by the Oracle switch structure xaoswd. You can use the following method to access the xaosw switch table in a database-independent manner:
 
static void* RWDBManager::xaSwitch(const RWCString& accessLib)
For static libraries, you must supply the database-specific string to the xaSwitch() method. Note that the value of the accessLib parameter is the same here as it is in the RWDBManager::database() method. For example:
 
(struct xa_switch_t *)RWDBManager::xaSwitch("ORACLE_OCI");
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("liboci<ver>15d.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.