The ax_reg() function
The ax_reg() function registers an XA data source with the current transaction. This function must be repeated with each new transaction.
int ax_reg(int rmid, XID *xid, int4 flags)
#include "xa.h"
#include "milib.h"
int rmid, retcode;
XID *xid;
if ( (rmid = mi_xa_get_xadatasource_rmid("informix.Newyork")) <= 0)
{
/* Error while getting XA data source id */
}
if ( !(xid = (XID *)mi_alloc(sizeof(XID)) ))
{
/* Memory allocation error */
}
retcode = ax_reg(rmid, xid, TMNOFLAGS);
if (retcode != TM_OK )
{
/* ax_reg() Error */
}
/* ax_reg() is Successful */
- Be sure the correct rmid (resource manager ID) is correct.
You can use the mi_xa_get_xadatasource_rmid() function to enable the DataBlade module to get the ID the correct rmid value.
The resource manager ID must be present in a row in the sysxadatasources system catalog table that was created with the CREATE XADATASOURCE statement of SQL.
- Make sure xid is a valid pointer to the XID data structure, which is defined in the $INFORMIXDIR/incl/public/xa.h file. Make sure that memory for xid is allocated.
- Set flags to TMNOFLAGS. The value for TMNOFLAGS is defined in the $INFORMIXDIR/incl/public/xa.h file.
- Only call the ax_reg() function within an explicit or implicit transaction.
- Do not call the ax_reg() function in these
contexts:
- From the subordinator of a distributed transaction or from within
a resource manager global transaction
HCL Informix® can operate as a resource manager in a global transaction managed by a third party transaction manager. The ax_reg() function must not be used if HCL Informix is operating as a resource manager.
- In a non-logging database
- From any of the XA purpose functions that are specified in a CREATE XADATASOURCE TYPE statement, which creates a type of XA-compliant external data source.
- From the subordinator of a distributed transaction or from within
a resource manager global transaction
Multiple registrations of the same XA data source in a single transaction do not effect either the transaction or the XA data source.
For more information about this function, see the IBM® Informix DataBlade API Function Reference.