+

Search Tips | Advanced Search

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.


Check the Sybase environment variable settings

Ensure that your Sybase environment variables are set for queue manager processes as well as in the 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 and Linux systems, use:
    export SYBASE=/sybase
    
    On Windows systems, use:
    set SYBASE=c:\sybase
    

    SYBASE_OCS
    The directory under SYBASE where you have installed the Sybase client files.
    For example, on UNIX and Linux systems, use:
    export SYBASE_OCS=OCS-12_0
    
    On Windows systems, use:
    set SYBASE_OCS=OCS-12_0
    


Enable 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 


Create the Sybase switch load file

To create the Sybase switch load file, use the sample files supplied with IBM MQ. On Windows systems, we 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.

We 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 we 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.

Note: On AIX, the sample makefile has been modified as shown in the following example so that we can select a different SYBLINKFLAG64 value, depending on whether we 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 we 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

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

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

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 we want XA function calls to be logged:

XAResourceManager:
  Name=mysybase
  SwitchFile=sybswit
  XAOpenString=-Uuser -Ppassword -Nlrmname -L/tmp/sybase.log -Txa
  ThreadOfControl=THREAD


Use multi-threaded programs with Sybase

If we are using multi-threaded programs with IBM MQ global units of work incorporating updates to Sybase, we 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.

Parent topic: Scenario 1: Queue manager performs the coordination

Last updated: 2020-10-04