db2xa_open()--Open an XA Resource Manager (Job Scoped Locks)


  Syntax
 #include <xa.h>

 int db2xa_switch.xa_open_entry(char *xa_info,     
     int rmid, long flags);

  Default Public Authority: *USE

  Service Program: QTNXADTP

  Threadsafe: Yes

A transaction manager calls db2xa_open() to open the XA resource manager and to prepare it for use in the XA distributed transaction environment. This function must be called before any other resource manager (db2xa_) calls are made.

For additional information about parameters, authorities required, return values, and error conditions, see the xa_open() API.


Authorities

In addition to those documented for the xa_open() API, the following authorities are required.

Exit Program Authority (specified via the xa_info parameter SRVPGM keyword)
*USE
Exit Program Library Authority (specified via the xa_info parameter SRVPGM keyword)
*EXECUTE
Journal Authority (if specified via the xa_info parameter DFTJRN keyword)
*OBJOPR *ADD
Journal Library Authority (if specified via the xa_info parameter DFTJRN keyword)
*EXECUTE

Usage Notes

The usage notes for the xa_open() API apply to this API with the following differences.

xainfo String Keywords and Values


Sqlhold values

This section documents how the SQLHOLD keyword value affects SQL cursors during the following XA operations (other XA operations do not affect cursors):

This applies only to cursors associated with the connection that is used for the transaction branch affected by the XA operation. As shown below, cursors declared WITH HOLD are treated differently in some cases than those not declared WITH HOLD. Note that cursors can be declared WITH HOLD only when embedded SQL is used. CLI cursors are not declared WITH HOLD.


Example

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#include <xa.h>

main() {

  char xa_info[1024]=
       "tmname=mytranmgr srvpgm=tmlib/tmserv rdbname=myrdb";

  int  rmid;
  long flags;
  int  retcode;
  extern struct xa_switch_t db2xa_switch;

  retcode =
     db2xa_switch.xa_open_entry(xa_info, rmid, flags);
}


API introduced: V4R3

[ Back to top | UNIX-Type APIs | APIs by category ]