Configuring databases for coordinated message flows using DB2

If your message flow interacts with a DB2 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:

If you are using DB2 Version 8 on Linux, 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:
    • Start of changeYou must set the transaction processor monitor name (TP_MON_NAME) to MQ on Windows. You must not set this parameter if you are using a 64-bit DB2 instance. The setting of this variable is optional on 32-bit instances of DB2 on Linux and UNIX. End of change
    • 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:
        mqsistop broker
        export EXTSHM=ON (in the profile of all broker environments)
        mqsistart 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 products run in THREAD mode.

Using DB2 with only 32-bit execution groups

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 "DB2 configuration" in the WebSphere MQ System Administration Guide. You can also find details of how to configure XA resource definitions in this book.

Refer to the information provided for the version of WebSphere MQ that you have installed:

  • For coordination by WebSphere MQ V5:

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

    On Linux and UNIX (AIX, HP-UX, 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 Linux and UNIX systems, and the equivalent information for Windows.

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

    1. Create the following symbolic links:
      ln –s install_dir/sample/xatm/db2swit /var/mqm/exits/db2swit
      ln –s install_dir/sample/xatm/db2swit64 /var/mqm/exits64/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 only 64-bit execution groups

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 "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.

  1. Create the following symbolic link:
    ln –s install_dir/sample/xatm/db2swit64 /var/mqm/exits64/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
Related concepts
Message flows overview