Sybase configuration
Sybase support and configuration information.
Complete the following steps:For a current list of levels of Sybase supported by IBM MQ , see System Requirements for IBM MQ.
- Ensure we have installed the Sybase XA libraries, for example by installing the XA DTM option.
- Check environment variable settings.
- Enable Sybase XA support.
- Create the Sybase switch load file.
- Add resource manager configuration information.
Checking the Sybase environment variable settings
Ensure that your Sybase environment variables are set for queue manager processes as well as in our 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=/sybaseOn Windows systems, use:set SYBASE=c:\sybase- SYBASE_OCS
- The directory under SYBASE where we have installed the Sybase client files. For example, on UNIX and Linux systems, use:
export SYBASE_OCS=OCS-12_0On 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, 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.dllThe 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 you are using. Then execute the makefile using the command:make -f xaswit.mak sybswitThe 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 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 -bdynamicThe 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.
Add 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 Add configuration information to the queue manager.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:
- 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.
XAResourceManager: Name=mysybase SwitchFile=sybswit XAOpenString=-Uuser -Ppassword -Nlrmname -L/tmp/sybase.log -Txa ThreadOfControl=THREAD
Use 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.