Distributed transaction support

Distributed transactions allow an application to coordinate units of work across multiple databases.

There are two different interfaces into the ODBC driver that allow one to complete a distributed transaction. The two interfaces are MTS (Microsoft® Transaction Server) and XA API support. Both of these interfaces are affected by the setting of the XALOCKTIMEOUT and XATXNTIMEOUT connection string settings.

MTS

For more information on MTS refer to Using Microsoft Transaction Server (MTS).

XA API support

Refer to the 2140, 2141, 2142, and 2143 connection attributes on the Connection and statement attributes page for a description of some of the relevant options for getting the XA support to work. Note, that the 2141 and 2142 connection attributes do the same thing as the XALOCKTIMEOUT and XATXNTIMEOUT connection string settings.

Note:
  • Multiple iSeries™ connections can be included in the distributed transaction only on V5R3 or later servers.
  • xa_open is only called by the application for recovery purposes. When connecting through the ODBC API SQLConnect or SQLDriverConnect the xa_open is done automatically if the RMID was set via the 2142 connection attribute.
  • The connection attribute SQL_ATTR_AUTOCOMMIT must be set as SQL_AUTOCOMMIT_ON.
  • If an application wishes to start an XA transaction and then do some non-XA transaction work, one must set the RMID to 0 to indicate to the driver that the XA work is completed.
  • To do XA recovery an application calls xa_open with a string of: SYSTEM=mySystem;UID=myUserID;PWD="myPassword";DATABASE=myDatabase; – replacing mySystem with your system name, myUserID with your user ID on that system, and myPassword with that user ID's password. Note that the string must be specified exactly as shown. Alternatively you can specify just SYSTEM=mySystem;.