Sybase configuration

Do the following:

  1. Ensure you have installed the Sybase XA libraries, for example by installing the XA DTM option.
  2. Check environment variable settings.
  3. Enable Sybase XA support.
  4. Create the Sybase switch load file.
  5. Add resource manager configuration information.

A current list of levels of Sybase supported by WebSphere MQ is provided at:

http://www.ibm.com/software/ts/mqseries/platforms/supported.html

Checking the Sybase environment variable settings

Ensure that your Sybase environment variables are set for queue manager processes as well as in your application processes. In particular, always set the following environment variables before starting the queue manager:

SYBASE
The location of the Sybase product installation. For example, on UNIX(R) systems, use:
export SYBASE=/sybase
On Windows(R) systems, use:
set SYBASE=c:\sybase
SYBASE_OCS
The directory under SYBASE where you have installed the Sybase client files. For example, on UNIX systems, use:
export SYBASE_OCS=OCS-12_0
On Windows systems, use:
set SYBASE_OCS=OCS-12_0

Enabling Sybase XA support

Within the Sybase XA configuration file ($SYBASE/$SYBASE_OCS/xa_config), define a Logical Resource Manager (LRM) for each connection to the Sybase server that is being updated.

An example of the contents of $SYBASE/$SYBASE_OCS/xa_config is shown in Figure 14.

Figure 14. Example contents of $SYBASE/$SYBASE_OCS/xa_config
# The first line must always be a comment
 
[xa]
 
  LRM=lrmname
  server=servername 

Creating the Sybase switch load file

The easiest way to create the Sybase switch load file is to use the sample files supplied with WebSphere MQ.

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

nmake /f xaswit.mak sybswit.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 Sybase you are using. Then execute the makefile using the command:

make -f xaswit.mak sybswit

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 Sybase

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 Sybase as a participant in global units of work.

Figure 15 shows a UNIX sample, which uses the database associated with the lrmname LRM definition in the Sybase XA configuration file, $SYBASE/$SYBASE_OCS/xa_config. Include a log file name if you want XA function calls to be logged:

Figure 15. Sample XAResourceManager entry for Sybase on UNIX platforms
XAResourceManager:
  Name=mysybase
  SwitchFile=sybswit
  XAOpenString=-Uuser -Ppassword -Nlrmname -L/tmp/sybase.log -Txa
  ThreadOfControl=THREAD

Using multi-threaded programs with Sybase

If you are using multi-threaded programs with WebSphere MQ global units of work incorporating updates to Sybase, you must use the value THREAD for the ThreadOfControl parameter as shown in Figure 15.

Also ensure that you link your program (and the switch load file) with the threadsafe Sybase libraries (the _r versions).