[UNIX, Linux, Windows, IBM i]

Sybase configuration

Sybase support and configuration information.

Complete the following steps:
  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.
For a current list of levels of Sybase supported by IBM® MQ, see System Requirements for IBM MQ.

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
[UNIX][Linux]The location of the Sybase product installation. For example, on UNIX and Linux® systems, use:

export SYBASE=/sybase
[Windows]On Windows systems, use:

set SYBASE=c:\sybase
SYBASE_OCS
The directory under SYBASE where you have installed the Sybase client files.
[UNIX][Linux]For example, on UNIX and Linux systems, use:

export SYBASE_OCS=OCS-12_0
[Windows]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. Here is an example of the 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

To create the Sybase switch load file, use the sample files supplied with IBM MQ. On Windows systems, you can find xaswit.mak in the directory C:\Program Files\IBM\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\MQ\exits.

You can find xaswit.mak in the directory MQ_INSTALLATION_PATH/samp/xatm. MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.

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.

[AIX][V9.1.0.2 Apr 2019][V9.1.2 Mar 2019]Note: On AIX®, the sample makefile has been modified as shown in the following example so that you can select a different SYBLINKFLAG64 value, depending on whether you are using Sybase 15 ESD#5 or later, or an earlier version of Sybase.
SYBLINKFLAGS32=-brtl
# The following line is for Sybase 15
#SYBLINKFLAGS64=-brtl
# The following line is for Sybase 16
SYBLINKFLAGS64=-bstatic -bdynamic

The only change you need to make to the makefile is to ensure that only one of the SYBLINKFLAGS64 values is uncommented. The default is Sybase 16, which is the value to use for 15 #ESD5 and later.

Any XA switch file that is produced is linked to that specific release of Sybase and must not be moved to other platforms.

If the level of Sybase is changed, then the XA switch file should be rebuilt.

Adding resource manager configuration information for Sybase

You must modify the configuration information for the queue manager to declare Sybase as a participant in global units of work. Modifying the configuration information is described in more detail in Adding configuration information to the queue manager.
  • [Windows][Linux]On Windows and Linux (x86 and x86-64 platforms) systems, use the IBM MQ Explorer. Specify the details of the switch load file in the queue manager properties panel, under XA resource manager.
  • On all other systems specify the details of the switch load file in the XAResourceManager stanza in the queue manager's qm.ini file.
[UNIX][Linux]The following example shows a Sample XAResourceManager entry for Sybase on UNIX and Linux, 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:

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 IBM MQ global units of work incorporating updates to Sybase, you must use the value THREAD for the ThreadOfControl parameter. Also ensure that you link your program (and the switch load file) with the threadsafe Sybase libraries (the _r versions). Using the value THREAD for the ThreadOfControl parameter is shown in the previous example.