The xa_open() function

The xa_open() function is called once per database session for each XA data source that participates in the HCL Informix® transaction. The xa_open() function is called when a user-defined function registers the XA data source with a transaction by calling mi_register_xadatasource() or using ax_reg() for the first time after the database opens.

Subsequent calls to mi_register_xadatasource() or ax_reg() in the same the same database session do not result in the invocation of the xa_open() function.

The syntax for the function is:
 mint xa_open(char *xa_info, /* IN */
            mint rmid,     /* IN */
            int4 flags)   /* IN */
Table 1. The xa_open() parameters
Parameter Description
xa_info Information string ("session-id:databasename@servername")
rmid Unique resource manager identifier
flags TMNOFLAGS, the valid value
The following code fragment contains the xa_open() function:
#include "xa.h"
mint mqseries_open(char *xa_info, mint rmid, int4 flags)
  {
/* setup the datastructures/etc.  */
if ( (myloc = mi_dalloc(sizeof(struct my_location), PER_SESSION))
     == (char *) NULL)
    {
    return XAER_RMERR;
    }
….
Return XA_OK;
  }

For valid return values, refer to X/Open information, including Distributed Transaction Processing: The XA Specification.