Configuring global coordination with Db2

Configure your IBM® App Connect Enterprise environment to globally coordinate message flow transactions with updates in DB2® databases under the control of your integration node queue manager.

Before you begin

Ensure that the databases are configured for global coordination of transactions, see Configuring databases for global coordination of transactions.

On distributed systems, an IBM MQ queue manager associated with the integration node performs the transaction manager role, which means that IBM App Connect Enterprise requires access to IBM MQ when processing messages. For more information about using IBM MQ with IBM App Connect Enterprise, see Installing IBM MQ.

Procedure

Follow the instructions appropriate to your platform:

Linux® and UNIX

Procedure

  1. Run the mqsimanagexalinks command to create the links that are required by IBM MQ to include databases in XA transactions.
    For more information, see mqsimanagexalinks command.
  2. Configure the integration node queue manager with XA resource manager information for each database that is involved in the transaction that the queue manager will globally coordinate.
    1. Open the queue manager's qm.ini file in a text editor.
      The qm.ini file is located at /var/mqm/qmgrs/queue_manager_name/qm.ini, where queue_manager_name is the name of the integration node that is associated with the queue manager.
    2. At the end of the qm.ini file, paste the following stanza:
      XAResourceManager:
      Name=DB2
      SwitchFile=db2swit
      XAOpenString=db=MyDataSource,uid=MyUserId,pwd=MyPassword,toc=t
      XACloseString=
      ThreadOfControl=THREAD
      
    3. On the XAOpenString line, replace the following values with values that are appropriate for your configuration:
      • MyDataSource is the name of the data source to which you want to connect.
      • MyUserId must be the user name that the integration node uses to connect to the database.
        You can define the user name that the integration node uses in a number of ways; make sure that you specify the correct name in this file. The integration node determines the user name by checking the following conditions in the order listed:
        1. A specific user name and password for this data source name (DSN), that you have defined by running the mqsisetdbparms command.
        2. A default user name and password for all DSNs, that you have defined by running the mqsisetdbparms command.
        3. The integration node service user name, which you define with the -i parameter on the mqsicreatebroker command
      • MyPassword is the password that is associated with the user name.
    4. Accept the default values for all the other lines in the stanza.
      For example:
      XAResourceManager:
      Name=DB2
      SwitchFile=db2swit
      XAOpenString=db=MYDB,uid=wbrkuid,pwd=wbrkpw,toc=t
      XACloseString=
      ThreadOfControl=THREAD
      
  3. The DB2 switch file is supplied by IBM App Connect Enterprise, and uses dynamic XA registration (see Configuring databases for global coordination of transactions).
  4. Linux platformUNIX platformStop then restart the queue manager to apply the changes, because qm.ini is read only while the queue manager is running. Before you restart the queue manager, ensure that the ODBCINI and ODBCSYSINI environment variables have been exported, and that the user ID that the queue manager processes will run under has read access to the odbc.ini and odbcinst.ini files.
    To stop and restart the queue manager, enter the following commands, where queue_manager_name is the name of the queue manager:
    endmqm queue_manager_name
    strmqm queue_manager_name

    When the queue manager restarts, check the queue manager log for all warnings that are associated with the restart. The log files are located in /var/mqm/qmgrs/queue_manager_name/errors, where queue_manager_name is the name of the queue manager that you restarted.

    When the queue manager restarts successfully, the changes that you made to qm.ini are applied.

Results

Db2 is now configured for global coordination with the integration node queue manager coordinating transactions.

What to do next

You can deploy globally coordinated message flows to the integration node.

Windows

Procedure

  1. Windows platformConfigure the integration node queue manager with XA resource manager information for each database that is involved in the transaction that the queue manager will globally coordinate.
    1. From the Start menu, open IBM MQ Explorer.
    2. Open the queue manager Properties dialog box, then open XA resource managers.
    3. Click the Add button to create a resource manager.
      1. In the Name field, enter a name to refer to a resource manager.
      2. In the SwitchFile field, enter db2swit
      3. Copy the provided DB2 switch files from the integration node install location to the queue managers exits and exits64 directories (by default under C:\Program Files (x86)\IBM\WebSphere MQ).
        Copy the file:
        install_dir\server\sample\xatm\db2swit32.dll
        into the queue managers exits directory, and rename it to db2swit.dll.
        Copy the file
        install_dir\server\sample\xatm\db2swit.dll
        into the queue managers exits64 directory.
      4. In the XAOpenString field, paste the following string:
        db=MyDataSource,uid=MyUserId,pwd=MyPassword,toc=t
      5. In the XAOpenString field, replace the values with values that are appropriate for your configuration:
        1. MyDataSource is the name of the data source to which you want to connect.
        2. MyUserId must be the user name that the integration node uses to connect to the database.
          You can define the user name that the integration node uses in a number of ways; make sure that you specify the correct name in this file. The integration node determines the user name by checking the following conditions in the order listed:
          1. A specific user name and password for this data source name (DSN), that you have defined by running the mqsisetdbparms command.
          2. A default user name and password for all DSNs, that you have defined by running the mqsisetdbparms command.
          3. The integration node service user name, which you define with the -i parameter on the mqsicreatebroker command
        3. MyPassword is the password that is associated with the user name.
        For example:
        db=MYDB,uid=wbrkuid,pwd=wbrkpw,toc=t
      6. Accept the default values for all the other fields on the page.
  2. Windows platformStop then restart the queue manager to apply the changes.
    To stop and restart the queue manager, enter the following commands, where queue_manager_name is the name of the queue manager:
    endmqm queue_manager_name
    strmqm -si queue_manager_name

    When the queue manager restarts, check the queue manager log for all warnings that are associated with the restart. The log files are located in install_dir\WebSphere MQ\Qmgrs\QMGR\errors, where install_dir is the location in which the integration node is installed and QMGR is the name of your IBM MQ Queue manager.

    When the queue manager restarts successfully, the changes that you made are applied.

Results

Db2 is now configured for global coordination with the integration node queue manager coordinating transactions.

What to do next

you can deploy globally coordinated message flows to the integration node.