XA distributed transaction environment
With Db2® Mirror, the XA distributed transaction environment is partially supported. Db2 Mirror database transactional activity is based on the application job having a corresponding QDBMSRVR job on the target node. The corresponding QDBMSRVR job is logically linked with the application job for the unit of work.
For Db2 Mirror, XA distributed NTS transactions can be used as long as certain restrictions are met.
- An XID identifying a global transaction may only be used in one job (i.e. JDBC or other client connection) on the node once replicated objects are accessed by the transaction. This means that xa_start, xa_end, xa_prepare, xa_commit, or xa_rollback for a given XID must all be done in the same job. For example, if job A uses a global transaction with a given XID, then job B will not be allowed to use a global transaction with the same XID. An attempt to use the global transaction from a second job will result in application failure. If this situation is encountered, an error is returned to the application and the global transaction is set to rollback only.
- If an XID is used for a global transaction on a source node, the same XID should not be used on the target node. If the application is designed to run Active/Active, the application must use unique XID’s when running from both the primary and secondary nodes. If a specific XID is used at the same time, initiating from both nodes, the application activity will not be protected with a failure and could encounter lock conflicts.