See information about the latest product version
Configuring a JDBC type 4 connection for globally coordinated transactions
If you want the database that you access through a JDBC type 4 connection to participate in globally coordinated transactions, set up the appropriate environment.
Complete the following steps:
- Check that the definition of your JDBCProvider
service is appropriate for coordinated transactions.
For example, to set up the required JDBC classes:
- For DB2®, set type4DatasourceClassName to com.ibm.db2.jcc.DB2XADataSource and type4DriverClassName to com.ibm.db2.jcc.DB2Driver
- For Oracle, set type4DatasourceClassName to oracle.jdbc.xa.client.OracleXADataSource and type4DriverClassName to oracle.jdbc.OracleDriver
- Define the switch file and the database properties:
On Linux and UNIX systems, open the qm.ini file for the broker queue manager with a text editor. Add the following stanza for each database:
XAResourceManager: Name=Database_Name SwitchFile=JDBCSwitch XAOpenString=JDBC_DataSource ThreadOfControl=THREAD
Database_Name is the database name (DSN) of the database defined to the JDBCProvider configurable service (for example, specified by -n databaseName -v Database_Name on the mqsichangeproperties command).
JDBCSwitch is a fixed generic name that represents the switch file for XA coordination. Use this value, or another single fixed value, in each stanza; the specific switch file that the queue manager uses is defined by the symbolic links you create in the next step.
JDBC_DataSource is the identifier of the JDBCProvider configurable service (the value that you specified for the -o parameter on the mqsichangeproperties command).
Define a stanza for each database (DSN) that you connect to from this broker. You must create separate definitions even if the DSNs resolve to the same physical database. Therefore, you must have a stanza for each JDBCProvider configurable service that you have defined, because each service can define the properties for a single database.
On Windows on x86 systems, open WebSphere® MQ Explorer and select the queue manager for your broker, for example BROKERQM.
Open the XA resource manager page, and modify the attributes to create the definition of the database. The attributes are the same as those shown for Linux and UNIX; Name, SwitchFile, XAOpenString, and ThreadofControl. Leave the additional attribute, XACloseString, blank.
Enter the fully qualified file name in SwitchFile; install_dir\bin\JDBCSwitch.dll.
On Windows on x86-64 systems, open WebSphere MQ Explorer and select the queue manager for your broker, for example BROKERQM.
Open the XA resource manager page, and modify the attributes to create the definition of the database. The attributes are the same as those shown for Linux and UNIX; Name, SwitchFile, XAOpenString, and ThreadofControl. Leave the additional attribute, XACloseString, blank.
Enter JDBCSwitch in SwitchFile.
- Set up queue manager access to the switch file:
On Linux and UNIX systems, create a symbolic link to the switch files that are supplied in your install_dir/lib directory.
install_dir is the directory to which you installed the Broker component. The default location for this directory is /opt/ibm/mqsi/v.r.m.f on Linux, or /opt/IBM/mqsi/v.r.m.f on UNIX systems. The default directory includes the version, release, modification, and fix of the product, in the format v.r.m.f (version.release.modification.fix).
Set up links in the /var/mqm/exits directory, or the /var/mqm/exits64 directory, or both. The file names for each platform are shown in the following table.
Platform 32-bit file 64-bit file AIX®
libJDBCSwitch.so HP-Itanium
libJDBCSwitch.so Linux on POWER®
libJDBCSwitch.so Linux on IBM® z Systems
libJDBCSwitch.so Linux on x86
libJDBCSwitch.so Linux on x86-64
libJDBCSwitch.so Solaris on SPARC
libJDBCSwitch.so Solaris
on x86-64libJDBCSwitch.so Specify the same name of the switch file, JDBCSwitch or your own value, in both the /exits and /exits64 directories. For example, on AIX:
ln -s install_dir/lib/libJDBCSwitch.so /var/mqm/exits/JDBCSwitch and ln -s install_dir/lib/libJDBCSwitch.so /var/mqm/exits64/JDBCSwitch
On Windows, for the 32-bit version of WebSphere Message Broker, copy the JDBCSwitch.dll file from the install_dir\bin directory to the \exits subdirectory in the WebSphere MQ installation directory.
On Windows, for the 64-bit version of WebSphere Message Broker, copy the JDBCSwitch32.dll file from the install_dir\bin directory to the \exits subdirectory in the WebSphere MQ installation directory, and rename the file to JDBCSwitch.dll. Then, copy the JDBCSwitch.dll file from the install_dir\bin directory to the \exits64 subdirectory in the WebSphere MQ installation directory.
- Configure the message flow that includes one or more nodes
that access databases that are to participate in a globally coordinated
transaction.
- Open a WebSphere Message Broker Toolkit session.
- Switch to the Broker Application Development perspective.
- Add the message flow that includes the node or nodes that connect to the database that is to participate in a globally coordinated transaction to a new or existing BAR file.
- Build the BAR file.
- Click the Configure tab, select the message flow that you have added, and select the Coordinated Transaction check box.
If you have been following the instructions in Working with databases, the next task is Configuring ODBC connections for globally coordinated transactions (optional).