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

Set up your JDBC provider definition.

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:

Procedure

  1. 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.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
    Consult your database administrator or the documentation provided by your database supplier, to confirm that all the JDBCProvider service properties are set appropriately. For example, a database supplier might require secure access if it is participating in coordinated transactions.
  2. Define the switch file and the database properties:
    1. The JDBC switch file is supplied by IBM Integration Bus, and uses static XA registration (see Configuring databases for global coordination of transactions).
    2. Linux platformOn 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_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 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.

    3. Windows platformOn 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.

  3. Set up queue manager access to the switch file:
    1. Linux platformOn 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, JDBCSwitch or your own value, in the /exits64 directory.

    2. Windows platformOn 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.
  4. Configure the message flow that includes one or more nodes that access databases that are to participate in a globally coordinated transaction.
    1. Open an IBM Integration Toolkit session.
    2. Switch to the Integration Development perspective.
    3. 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.
    4. Build the BAR file.
    5. Click the Configure tab, select the message flow that you have added, and select the Coordinated Transaction check box.

What to do next

If your integration node is running on Windows, authorize the integration node and its queue manager to access resources associated with the JDBCProvider configurable service.

If you have been following the instructions in Working with databases, the next task is Configuring ODBC connections for globally coordinated transactions (optional).