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, an IBM® MQ queue manager associated with the integration node performs the transaction manager role, which means that IBM App Connect Enterprise requires access to IBM MQ when processing messages. For more information about using IBM MQ with IBM App Connect Enterprise, 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 JDBC Providers policy is appropriate for coordinated transactions.

    For example, to set up the required JDBC classes:

    • For DB2®, set JDBC type 4 data source class name to com.ibm.db2.jcc.DB2XADataSource and JDBC driver class name to com.ibm.db2.jcc.DB2Driver.
    • For Oracle, set JDBC type 4 data source class name to oracle.jdbc.xa.client.OracleXADataSource and JDBC driver class name to oracle.jdbc.OracleDriver.
    Consult your database administrator or the documentation provided by your database supplier, to confirm that all the JDBC Providers policy 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 App Connect Enterprise, and uses static XA registration (see Configuring databases for global coordination of transactions).
    2. Linux platformOn Linux® and UNIX 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 JDBC Providers policy.

      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 JDBC Providers policy.

      Define a stanza for each database (DSN) that you connect to from this integration server. You must create separate definitions even if the DSNs resolve to the same physical database. Therefore, you must have a stanza for each JDBC Providers policy 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 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.

  3. Set up queue manager access to the switch file:
    1. Linux platformOn Linux and UNIX systems, 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 App Connect Enterprise. The default location for this directory is install_dir/ace-13.0.n.0/server on Linux, or /opt/IBM/mqsi/13.0.n.0/server 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/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. For example, on AIX®:
      ln -s install_dir/server/lib/libJDBCSwitch.so /var/mqm/exits64/JDBCSwitch
    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 App Connect Enterprise 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 queue manager to access resources that are associated with the JDBC Providers policy (see Authorizing access to JDBC type 4 JDBCProvider resources on Windows).

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