IBM Books

Call Level Interface Guide and Reference

Attributes that Govern Distributed Unit of Work Semantics

A coordinated transaction means that commits or rollbacks among multiple database connections are coordinated. The SQL_COORDINATED_TRANS setting of the SQL_ATTR_CONNECTTYPE attribute corresponds to the Type 2 CONNECT in IBM embedded SQL and must be considered in conjunction with the SQL_ATTR_SYNC_POINT attribute, which has the following two possible settings:

Similar to SQL_ATTR_CONNECTTYPE, it is recommended that the application set this environment attribute, if necessary, as soon as the environment handle has been created with a call to SQLAllocHandle() (with a HandleType of SQL_HANDLE_ENV). ODBC applications must use SQLSetConnectAttr() to set this for each connection handle under the environment before any connections have been established.

All the connections within an application must have the same SQL_ATTR_CONNECTTYPE and SQL_ATTR_SYNC_POINT settings. After the first connection has been established, all subsequent connect types must be the same as the first. Coordinated connections default to manual-commit mode (for discussion on auto-commit mode, see "Commit or Rollback").

The function SQLEndTran() must not be used in a Distributed Unit of Work environment. The commit or rollback must be done using the transaction manager APIs.

Figure 5 shows the logical flow of an application executing statements on two SQL_CONCURRENT_TRANS connections ('A' and 'B'), and indicates the scope of the transactions.

Figure 6 shows the same statements being executed on two SQL_COORDINATED_TRANS connections ('A' and 'B'), and the scope of a coordinated distributed transaction.

Figure 5. Multiple Connections with Concurrent Transactions


* Figure SQLL0G02 not displayed.

Figure 6. Multiple Connections with Coordinated Transactions


* Figure SQLL0G03 not displayed.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]