Sybase configuration

WebSphere MQ supports:

when used in conjunction with the Sybase XA-Server component Version 11.1.1 on the following platforms:

You need to do the following:

  1. Check environment variable settings.
  2. Create symbolic links for Sybase libraries (Solaris only).
  3. Enable Sybase XA support.
  4. Create the Sybase switch load file.
  5. Add resource manager configuration information.

Enabling Sybase XA support

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

Refer to the Sybase publication, XA-Server Integration Guide for Tuxedo (Document ID 35002-01-1111-01), and to the Release Bulletin XA-Server Version 11.1.1 appropriate to your platform for information about configuring the Sybase server for XA support and modifying the Sybase XA configuration file, $SYBASE/xa_config.

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

Figure 19. Example contents of $SYBASE/xa_config


# The first line must always be a comment
 
[xa]
 
  LRM=lrmname
  server=servername
  xaserver=xaservername 

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.

The xa.h header file is in the same directory as sybswit.c.

The source for the switch load file can be found in:

Linking the XA switch load file with Sybase libraries

As explained in "Creating the Oracle switch load file (UNIX systems)", the queue manager processes do not inherit the environment variables (LD_LIBRARY_PATH on Solaris and LIBPATH on AIX) from the shell in which the strmqm command was issued. To find the libraries when the queue manager starts up, specify a runtime linking path when the switch load file is built. The sample makefiles in the following sections operate in this way.

Creating the Sybase switch load file on Windows systems

To create the Sybase switch load file on Windows systems, compile sybswit.c and link it with libxaserver.lib.

To create the DLL:

  1. Create a directory into which you want to build the switch file. Define the switch file to WebSphere MQ as a fully-qualified name so that the DLL does not need to be built into a directory with LIBPATH. Makefiles are provided for building the switch file using both the Microsoft Visual C++ and IBM VisualAge(R) for C++ compilers.
  2. Copy the following files from C:\Program Files\IBM\WebSphere MQ\tools\c\samples\xatm into your new directory:
  3. How you continue depends on whether you are using Microsoft Visual C++ or IBM VisualAge for C++.

    For Microsoft Visual C++:

    1. Copy xaswit.mak.
    2. Use the source code shown in Figure 20, which forms part of xaswit.mak on Windows systems, to build the switch load file using the Microsoft Visual C++ compiler.

      Figure 20. Makefile for Sybase switch on Windows systems using Microsoft Visual C++


      !include <ntwin32.mak>
       
      sybswit.lib sybswit.exp: $*.obj $*.def
                               $(implib) -machine:$(CPU) \
                               -def:$*.def $*.obj
       
      sybswit.dll: $*.obj $*.def $*.exp
                   $(link) $(dlllflags)    \
                   -base:0x1C000000        \
                   $*.exp $*.obj           \
                   $(conlibsdll) libxaserver.lib
       
      .c.obj:
          $(cc) $(cflags) $(cvarsdll) $*.c
      
    3. Issue an nmake -f xaswit.mak sybswit.dll command to create the Sybase switch load file, sybswit.dll.
    For IBM VisualAge for C++:
    1. Copy xaswiti.mak.
    2. Use the source code shown in Figure 21, which forms part of xaswiti.mak on Windows systems, to create the switch load file using the IBM VisualAge for C++ compiler.

      Figure 21. Makefile for Sybase switch on Windows systems using IBM VisualAge for C++


      .\sybswit.obj: \
          sybswit.c \
          {$(INCLUDE);}xa.h
          @echo " Compile "
          icc.exe /Gm /Ti- /Gd /Ge- /Gf- /Fosybswit.obj /C sybswit.c
       
      .\sybswit.exp: \
          .\sybswit.obj
          @echo " Make exp and lib files "
          ilib.exe /Gi:sybswit .\sybswit.obj
       
      .\sybswit.dll: \
          .\sybswit.exp \
          .\sybswit.obj \
          {$(LIB)}libxaserver.lib
          @echo " Link "
          icc.exe @<<
           /B" /de /pmtype:vio /noe /code:RX /data:RW /dll"
           /B" /def"
           /B" /def:libxaserver"
           /B" /nod:sybswit.lib"
           /Fesybswit.dll
           libxaserver.lib
           .\sybswit.exp
           .\sybswit.obj
      
    3. Issue an nmake -f xaswiti.mak sybswit.dll command to make the Sybase switch load file.

Creating the Sybase switch load file on UNIX systems

WebSphere MQ provides a sample makefile, xaswit.mak, to build the switch files for a variety of database products. You can find xaswit.mak in the directory /usr/mqm/samp/xatm, with the source files you need to build the switch.

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 switch file is placed in your current directory.

Adding resource manager configuration information for Sybase

The next step is to modify the configuration information for the queue manager to define Sybase as a participant in global units of work. On Windows systems, use the Resources page of the properties for the queue manager (accessed from the WebSphere MQ Services snap-in). On UNIX systems, use the XAResourceManager stanza of the qm.ini configuration file.

Name=Name (mandatory)
The name by which this participant is known. You could include the name of the database being updated.

SwitchFile=name (mandatory)
The fully-qualified name of the Sybase switch load file.

XAOpenString=string
The XA open string for Sybase must have the following syntax:
   -Uusername -Ppassword -Nconnection_name -Llogfile -Ttype

where:

-U
User access information; username is a valid Sybase user ID.

-P
The password of the specified user.

-N
The LRM name corresponding to a connection to the database. Define it in the Sybase xa_config file as described in Enabling Sybase XA support.

-L
The path name of the file where Sybase XA-Library error information is logged. Ensure that the user mqm has write privileges for this file. This field is optional; no error information is logged if you omit it.

-T
The type of logging used. See the Sybase publication XA-Server Integration Guide for Tuxedo for a list of log types.

XACloseString=string
Sybase does not require an XA close string.

ThreadOfControl=THREAD|PROCESS
Sybase is not thread aware, so specify PROCESS.

In Figure 22, the MQBankDB database is associated with the lrmname LRM definition in the Sybase XA configuration file, $SYBASE/xa_config. Include a log file if you want XA function calls to be logged.

Figure 22. Sample XAResourceManager entry for Sybase on UNIX platforms


XAResourceManager:
  Name=Sybase MQBankDB
  SwitchFile=/usr/bin/sybswit
  XAOpenString=-Uuser -Ppassword -Nlrmname -L/tmp/sybase.log -Txa


© IBM Corporation 1994, 2002. All Rights Reserved