SQL Server RM Switch Module

Provides the information required to build the SQL Server RM switch module.

The SQL Server module provides two-phase commit support to ensure that any database connections made using this switch module all participate in a single XA transaction.

Source Code
The SQL Server RM switch module COBOL source file, ESMSSQL.CBL is located by default in the %ProgramFiles(x86)%\Micro Focus\Enterprise Developer\src\enterpriseserver\xa directory.
Note: If you prefer to supply user credentials programmatically rather than in the xa_open string, instructions for doing so are provided in the COBOL source file in the Customization section.
Build Requirements
To build the SQL Server RM switch module, you must have the Windows Software Development Kit (SDK) installed for your version of Windows.

Before building this switch module, ensure that your LIB environment variable contains the path to the odbc32.lib file, located in a subdirectory under your Windows SDK LIB directory.

Some OpenESQL directives are process-based, and typically need to be set in within the code of the program that makes the database connection.

If you are executing services under Enterprise Server that are deployed as container-managed applications, the applicable directives must be specified when compiling the RM switch module, rather than when compiling your program source. For more information, see the list of Process-based OpenESQL directives in the topic Scope - OpenESQL SQL Compiler Directive Options.

Building the Switch Module
Important: Beginning with the SQL Server ODBC 17.3 driver, Microsoft has changed their XA protocol. Use the MSSQL17 build option if you are using ODBC 17.3 or later. Currently, later Microsoft ODBC 17 versioned drivers will work with SQL Server 2017 and later only. For SQL Server 2016 and earlier, you must use the MSSQL build option and an earlier version of the SQL Server ODBC driver.
Method 1
  1. Start an Enterprise Developer command prompt, 32-bit or 64-bit depending on the application, running as an administrator.
  2. Change to the %ProgramFiles(x86)%\Micro Focus\Enterprise Developer\src\enterpriseserver\xa directory (default location).
  3. Enter build mssql
    Important: For ODBC Driver 17 for SQL Server versions 17.3 and later, enter build mssql17 instead.
Method 2
  1. Start an Enterprise Developer command prompt, 32-bit or 64-bit depending on the application.
  2. Copy all files from the %ProgramFiles(x86)%\Micro Focus\Enterprise Developer\src\enterpriseserver\xa directory (default location) to any location where you have WRITE permission.
  3. Change to the directory containing the copied files.
  4. Enter build mssql
    Important: For ODBC Driver 17 for SQL Server versions 17.3 and later, enter build mssql17 instead.
Build Output
The build process produces two binary switch module files from the ESMSSQL.CBL COBOL source file:
Binary File Type
ESMSSQL.DLL static
ESMSSQL_D.DLL dynamic

You can register an RM switch module with Enterprise Server dynamically, or register it statically depending on which binary file you use. Micro Focus recommends that you use the dynamic switch module option, as this ensures that only active databases used in the global transaction participate in the TM/RM XA flow.

Additional Resources
See SQL Server xa_open string for more information on using the SQL Server RM switch module xa_open string.