Configuring databases for coordinated message flows using DB2

If your message flow interacts with an Oracle database, and you want to coordinate the updates made to the database with other actions within the message flow, configure your broker to manage these updates.

Before you start:

To complete this task, you must have completed the following task:

When using DB2 Version 8 on UNIX or Windows systems, DB2 Version 8.1 Fix Pack 5 is the minimum level that is supported and you must configure the following values.
  1. Database configuration:
    • Set the transaction processor monitor name (TP_MON_NAME) to MQ.
    • Ensure that you have adequate connection resources; either use all TCP/IP connections or enable extended shared memory.
    • To enable shared memory support for DB2, take the following steps:
      • Turn on extended shared memory in the DB2 server:

        Export EXTSHM=ON
        db2set DB2ENVLIST=EXTSHM
        db2stop
        db2start

      • Turn on shared memory support in the broker environment:

        Stop the broker
        Export EXTSHM=ON in the profile of all broker environments
        Restart the broker

  2. Queue Manager configuration:

    The toc (Thread of Control) specified in the XAOpenString determines the mode in which the Resource Manager (DB2) runs. The ThreadOfControl stanza specifies the mode in which the Transaction Manager (WebSphere MQ) runs. Specify explicit values to ensure that both run in THREAD mode.

Using DB2 with a 32 bit broker

If you want to use DB2 in coordinated transactions:

  • If you use DB2 Version 8, use the supplied switch file; a file called db2swit is provided for each supported platform. These files are installed in the directory <install_dir>/sample/xatm

If you prefer to build your own files, follow the instructions in the section called "DB2 configuration" in the WebSphere MQ System Administration Guide. You can also find details of how to configure XA resource definitions in this book.

  • For coordination by WebSphere MQ V5:

    The following examples show what you must include in the XAResourceManager stanza in the qm.ini file on UNIX systems, and the equivalent information for Windows.

    On UNIX (AIX, HP-UX, Linux (x86 platform), and Solaris):

    XAResourceManager:
    Name=DB2
    SwitchFile=install_dir/sample/xatm/db2swit
    XAOpenString=db=yourdatabase,uid=youruserid,pwd=yourpassword,toc=t
    XACloseString=
    ThreadOfControl=THREAD

    On Windows, set the following values on the Resources page of the properties dialog for your WebSphere MQ queue manager. This example assumes that you have installed WebSphere Message Broker in the directory C:\WMQI:

    SwitchFile: C:\wmqi\sample\xatm\db2swit.dll
    XAOpenString=db=yourdatabase,uid=youruserid,pwd=yourpassword,toc=t
    ThreadOfControl=THREAD
  • For coordination by WebSphere MQ V6:

    The following examples show what you must include in the XAResourceManager stanza in the qm.ini file on UNIX systems, and the equivalent information for Windows.

    On UNIX (AIX, HP-UX, Linux (x86 platform), and Solaris):

    1. Create the following Symbolic link:
      ln –s install_dir/sample/xatm/db2swit /var/mqm/exits/db2swit
    2. Include the following code in the XAResourceManager stanza in the qm.ini file

      XAResourceManager:
      Name=DB2
      SwitchFile=db2swit
      XAOpenString=db=yourdatabase,uid=youruserid,pwd=yourpassword,toc=t
      XACloseString=
      ThreadOfControl=THREAD

    On Windows, set the following values on the Resources page of the properties dialog for your WebSphere MQ queue manager. This example assumes that you have installed WebSphere Message Broker in the directory C:\WMQI:

    SwitchFile: C:\wmqi\sample\xatm\db2swit
    XAOpenString=db=yourdatabase,uid=youruserid,pwd=yourpassword,toc=t
    ThreadOfControl=THREAD

Using DB2 with a 64 bit broker

If you want to use DB2 in coordinated transactions:

  • If you use DB2 Version 8, use the supplied switch file; a file called db2swit64 is provided for each supported platform. This file is installed as <Your install directory>/sample/xatm/db2swit64.

If you prefer to build your own files, follow the instructions in the section called "DB2 configuration" in the WebSphere MQ System Administration Guide. You can also find details of how to configure XA resource definitions in this book.

The following examples show what you must include in the XAResourceManager stanza in the qm.ini file on UNIX systems.

On UNIX (AIX, HP-UX, and Solaris):

  1. Create the following Symbolic link:
    ln –s install_dir/sample/xatm/db2swit64 /var/mqm/exits64/db2swit64
  2. Include the following code in the XAResourceManager stanza in the qm.ini file

    XAResourceManager:
    Name=DB2
    SwitchFile=db2swit64
    XAOpenString=db=yourdatabase,uid=youruserid,pwd=yourpassword,toc=t
    XACloseString=
    ThreadOfControl=THREAD
Related concepts
Message flows overview