Configuring XA Transaction Managers to Use DB2 UDB2

1.    Use the Encina Scheduling Policy API to specify how many application agents can be run from a single TP Monitor application process. For example:

2.     rc = mon_SetSchedulingPolicy (MON_EXCLUSIVE)

For DB2 (DB2 Universal Database, host, or AS/400 database servers), you should use the default setting of MON_EXCLUSIVE. This ensures that:

o    The application process is locked during the life time of the transaction.

o    The application acts single threaded.

Note:

If you are using the ODBC or DB2 Call Level Interface, you must disable the multithread support. You can do this by setting the CLI configuration parameter DISABLEMULTITHREAD = 1 (disables multithreading). The default for DB2 Universal Database is DISABLEMULTITHREAD = 0 (enables multithreading). Please see the CLI Guide and Reference.

3.    Use the Encina RM Registration API to provide the XA switch and the logical RM name to be used by Encina when referencing the RM in an application process. For example:

4.     rc = mon_RegisterRmi ( &db2xa_switch, /* xa switch */

5.     “inventdb”, /* logical RM name */

6.     &rmiId ); /* internal RM id */

The XA Switch contains the addresses of the XA routines in the RM that the TM can call, and it also specifies the functionality that is provided by the RM. The XA Switch of DB2 Universal Database is db2xa_switch, and it resides in the DB2 Client Application Enabler library (db2app.dll on INTEL platforms and libdb2 on UNIX-based platforms).

The logical RM name is the one used by Encina, and is not the actual database name that is used by the SQL application that runs under Encina. The actual database name is specified in the XA Open String in the Encina RM Registration. To simplify the situation, the logical RM name is set to be the same as the database name in this example.

The third parameter returns an internal identifier or handle that is used by the TM to reference this connection.

Note:

When using Encina for transaction processing with DB2 through the TM-XA interface, note that Encina nested transactions are not currently supported by the DB2 XA interface. If possible, avoid using these transactions. If you cannot, ensure that SQL work is done in only one member of the Encina transaction family.

Configuring BEA Tuxedo

Note:

Applications that access host or AS/400 database servers in a Tuxedo environment are limited to read-only access to these servers.

To configure Tuxedo to use DB2 as a resource manager, perform the following steps:

1.    Install Tuxedo as specified in the documentation for that product. Ensure that you perform all basic Tuxedo configuration, including the log files and environment variables.

You also require a compiler and the DB2 Software Developer’s Kit. Install these if necessary.

2.    At the Tuxedo server ID, set the DB2INSTANCE environment variable to reference the instance that contains the databases that you want Tuxedo to use. Also set the PATH variable to include the DB2 program directories. Then confirm that the Tuxedo server ID can connect to the DB2 databases.

3.    For Windows NT only. Update the tp_mon_name database manager configuration parameter with the name of the DLL that contains the ax_reg and ax_unreg routines. In Tuxedo, this DLL is called libtux.

4.    Add a definition for DB2 to the Tuxedo resource manager definition file. In the examples that follow, UDB_XA is the locally defined Tuxedo resource manager name for DB2, and db2xa_switch is the DB2-defined name for a structure of type xa_switch_t.:

o    For AIX. In the file ${TUXDIR}/udataobj/RM, add the definition:

o     # DB2 Version 5.0

o     UDB_XA:db2xa_switch:-L${DB2DIR} /lib -ldb2

Where {TUXDIR} is the directory where you installed Tuxedo, and {DB2DIR} is the DB2 instance directory.

o    For Windows NT. In the file %TUXDIR%\udataobj\rm, add the definition:

o     # DB2 Version 5.0

o     UDB_XA;db2xa_switch;%DB2DIR%\lib\db2api.lib

Where %TUXDIR% is the directory where you installed Tuxedo, and %DB2DIR% is the DB2 instance directory.

5.    Build the Tuxedo transaction monitor server program for DB2:

o    For AIX:

o     ${TUXDIR}/bin/buildtms -r UDB_XA -o ${TUXDIR}/bin/TMS_UDB

Where {TUXDIR} is the directory where you installed Tuxedo.

o    For Windows NT:

o     %TUXDIR%\bin\buildtms -r UDB_XA -o %TUXDIR%\bin\TMS_UDB

6.    Build the application servers. In the examples that follow, the -r option specifies the resource manager name, the -f option (used one or more times) specifies the files that contain the application services, the -s option specifies the application service names for this server, and the -o option specifies the output server file name.:

o    For AIX:

     

如果这文章对你有帮助,请扫左上角微信支付-支付宝,给于打赏,以助博客运营

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注