DB2 configuration

The supported levels of DB2(R) are defined at:

http://www.ibm.com/software/ts/mqseries/platforms/supported.html
Note:
32-bit instances of DB2 are not supported on platforms where the queue manager is 64-bit.

Do the following:

  1. Check the environment variable settings.
  2. Create the DB2 switch load file.
  3. Add resource manager configuration information.
  4. Change DB2 configuration parameters if necessary.

Read this information in conjunction with the general information provided in Configuring your system for database coordination.

Checking the DB2 environment variable settings

Ensure that your DB2 environment variables are set for queue manager processes as well as in your application processes. In particular, you must always set the DB2INSTANCE environment variable before you start the queue manager. The DB2INSTANCE environment variable identifies the DB2 instance containing the DB2 databases that are being updated. For example:

Warning:
If you run db2profile on UNIX platforms, the environment variable LIBPATH and LD_LIBRARY_PATH are set. It is advisable to unset these environment variables, see appropriate Quick Beginnings Guide.

Creating the DB2 switch load file

The easiest way to create the DB2 switch load file is to use the sample file xaswit.mak, which WebSphere MQ provides to build the switch load files for a variety of database products.

On Windows systems, you can find xaswit.mak in the directory C:\Program Files\IBM\WebSphere MQ\tools\c\samples\xatm. To create the DB2 switch load file with Microsoft Visual C++, use:

nmake /f xaswit.mak db2swit.dll
The generated switch file is placed in c:\Program Files\IBM\WebSphere MQ\exits.

On AIX(R), you can find xaswit.mak in the directory /usr/mqm/samp/xatm; on other UNIX systems, you can find it in the directory /opt/mqm/samp/xatm.

Edit xaswit.mak to uncomment the lines appropriate to the version of DB2 you are using. Then execute the makefile using the command:

make -f xaswit.mak db2swit

The generated 32-bit switch load file is placed in /var/mqm/exits.

The generated 64-bit switch load file is placed in /var/mqm/exits64.

Adding resource manager configuration information for DB2

The next step is to modify the configuration information for the queue manager, as described in Adding configuration information to the queue manager, to declare DB2 as a participant in global units of work.

Figure 11 is a UNIX sample, showing an XAResourceManager entry where the database to be coordinated is called mydbname, this name being specified in the XAOpenString:

Figure 11. Sample XAResourceManager entry for DB2 on UNIX platforms
XAResourceManager:
  Name=mydb2
  SwitchFile=db2swit
  XAOpenString=mydbname,myuser,mypasswd,toc=t
  ThreadOfControl=THREAD
Notes:
  1. ThreadOfControl=THREAD cannot be used with DB2 versions prior to version 8. It is recommended that you always set ThreadOfControl and the XAOpenString parameter toc to one of the following combinations:

Changing DB2 configuration parameters

For each DB2 database that the queue manager is coordinating, you need to:

Set database privileges
The queue manager processes run with effective user and group mqm on UNIX systems. On Windows systems, they run as the user that started the queue manager. This can be one of:
  1. The user who issued the strmqm command, or
  2. The user under which the IBM(R) MQSeries(R) Service COM server runs
By default, this user is called MUSR_MQADMIN.

If you have not specified a user name and password on the xa_open string, the user under which the queue manager is running is used by DB2 to authenticate the xa_open call. If this user (for example, user mqm on UNIX systems) does not have minimal privileges in the database, the database refuses to authenticate the xa_open call.

The same considerations apply to your application process. If you have not specified a user name and password on the xa_open string, the user under which your application is running is used by DB2 to authenticate the xa_open call that is made during the first MQBEGIN. Again, this user must have minimal privileges in the database for this to work.

For example, give the mqm user connect authority in the mydbname database by issuing the following DB2 commands:

db2 connect to mydbname 
db2 grant connect on database to user mqm 
See Security considerations for more information about security.
Change the tp_mon_name parameter
For DB2 for Windows systems only, change the TP_MON_NAME configuration parameter to name the DLL that DB2 uses to call the queue manager for dynamic registration.

Use the command db2 update dbm cfg using TP_MON_NAME mqmax to name MQMAX.DLL as the library that DB2 uses to call the queue manager. This must be present in a directory within PATH.

Reset the maxappls parameter
You might need to review your setting for the maxappls parameter, which limits the maximum number of applications that can be connected to a database. Refer to Database connections.