PostgreSQL RM Switch Module

Provides the information required to build the PostgreSQL RM switch module.
Restriction: This topic applies only when the Enterprise Server feature is enabled.

The PostgreSQL module provides two-phase commit support using PostgreSQL-provided SQL calls, and ensures that any database connections made using this switch module all participate in a single XA transaction.

PostgreSQL Server configuration for XA

Important: Before you can use the PostgreSQL RM Switch Module, you must configure the PostgreSQL Server by changing the value of the max_prepared_transactions property from its default value of 0 (zero) to a value greater than 0. After making this change, you must restart the server before proceeding. For additional details about the max_prepared_transactions configuration property, see your PostgreSQL documentation.
Source Code
The PostgreSQL RM switch module COBOL source file, ESPGSQLXA.CBL, is for use in Linux environments and located by default in the $COBDIR/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
The build script uses the current effective working mode to determine how to build the switch module.
Building the Switch Module
The $COBDIR/src/enterpriseserver/xa directory contains the build script file that you can use to build the switch module.
  1. Copy all files from the $COBDIR/src/enterpriseserver/xa directory (default location) to any location where you have WRITE permission.
  2. Change to the directory containing the copied files.
  3. Enter build pg
Build Output
The build process produces four binary RM switch module files from the ESPGSQLXA.CBL COBOL source file:
ESPGSQLXA.so 32-bit dynamic
ESPGSQLXA64.so 64-bit dynamic
ESPGSQLXA_S.so 32-bit static
ESPGSQLXA64_S.so 64-bit static

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
For more information on using the PostgreSQL RM switch module, including the xa_open string definition, see PostgreSQL xa_open string.