Distributed transaction support

Distributed transactions allow an IBM® i Access ODBC 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 Introducing Microsoft Transaction Server.

XA API support

Refer to the CWB_ATTR_XA_TXN_TIMEOUT, CWB_ATTR_XA_LOCK_TIMEOUT, CWB_ATTR_XA_RMID, and CWB_ATTR_XA_DLL_NAME 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 CWB_ATTR_XA_LOCK_TIMEOUT and CWB_ATTR_XA_TXN_TIMEOUT connection attributes do the same thing as the XALOCKTIMEOUT and XATXNTIMEOUT connection string settings.

Note:
  • 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 CWB_ATTR_XA_RMID 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;.