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.
Before you begin
About this task
On distributed systems, a IBM® MQ queue manager associated with the integration node performs the transaction manager role, which means that IBM Integration Bus requires access to IBM MQ when processing messages. For more information about using IBM MQ with IBM Integration Bus, see Installing IBM MQ.
Updates that you make to a database across a JDBC type 4 connection can be coordinated with other actions taken within the message flow, if you set up the resources to support coordination.
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 IBM
DB2®, set type4DatasourceClassName to
com.ibm.db2.jcc.DB2XADataSourceand type4DriverClassName to
- For Oracle, set type4DatasourceClassName to
oracle.jdbc.xa.client.OracleXADataSourceand type4DriverClassName to
- For IBM DB2®, set type4DatasourceClassName to
- Define the switch file and the database properties:
- The JDBC switch file is supplied by IBM Integration Bus, and uses static XA registration (see Configuring databases for global coordination of transactions).
- On Linux® systems, open the
qm.ini file for the integration node 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_Nameon the mqsichangeproperties command).
JDBCSwitchis 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 integration node. 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, open IBM MQ Explorer and select the queue
manager for your integration node, 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; 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, create a symbolic link to
the switch files that are supplied in your install_dir/server/lib directory.
install_dir is the directory to which you installed IBM Integration Bus. The default location for this directory is install_dir/iib-10.1.0.2/server on Linux. 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/exits64 directory. The file name for all platforms is libJDBCSwitch.so.
Specify the same name of the switch file,
JDBCSwitchor your own value, in the /exits64 directory.
- On Windows, copy the JDBCSwitch32.dll file from the install_dir\server\bin directory to the \exits subdirectory in the IBM MQ installation directory, and rename the file to JDBCSwitch.dll. Then, copy the JDBCSwitch.dll file from the install_dir\server\bin directory to the \exits64 subdirectory in the IBM MQ installation directory.
- On Linux, create a symbolic link to the switch files that are supplied in your install_dir/server/lib directory.
- Configure the message flow that includes one or more nodes
that access databases that are to participate in a globally coordinated
- Open an IBM Integration Toolkit session.
- Switch to the Integration 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.
What to do next
If you have been following the instructions in Working with databases, the next task is Configuring ODBC connections for globally coordinated transactions (optional).