The ax_unreg() function
The ax_unreg() function unregisters the previously registered XA data source from the transaction.
By default, all XA-compliant external data sources are unregistered at the end of a transaction. Use the ax_unreg() function to unregister the data source before the end of the transaction so the data source does not participate in the transaction.
Use the following syntax for an ax_unreg() function:
int ax_unreg(int rmid, int4 flags)
For example:
#include "xa.h"
#include "milib.h"
int rmid, retcode;
if ( (rmid = mi_xa_get_xadatasource_rmid("informix.Newyork")) <= 0)
{
/* Error while getting XA data source id */
}
retcode = ax_unreg(rmid, TMNOFLAGS);
if (retcode != TM_OK )
{
/* ax_uunreg() Error */
}
/* ax_unreg() is Successful */
When you use the ax_unreg() function,
follow these guidelines:
- Get the correct rmid (resource manager ID) value to use in the syntax for this function. If you do not know the resource manager ID, you can use the mi_xa_get_xadatasource_rmid() function to get the ID.
- Make sure the flags are passed as TMNOFLAGS.
- Only call the ax_unreg() function within an explicit or implicit transaction.
- Do not call the ax_unreg() function from these
contexts:
- From the subordinator of a distributed transaction
- From within a resource manager global transaction
- In a nonlogging database
- From any of the XA purpose functions that are specified in a CREATE XADATASOURCE TYPE statement.
- Do not unregister an XA data source that is not registered or already unregistered.
For more information about this function, see the IBM® Informix® DataBlade API Function Reference.