The mi_xa_register_xadatasource() function
The mi_xa_register_xadatasource() function registers an XA data source with the current transaction. The registration is dynamic and is applicable for the current transaction only. The must register participating data sources into each transaction.
Syntax
mi_integer mi_xa_register_xadatasource(mi_string *xasrc)- xasrc
- The user-defined name of the XA data source.
| Valid in client LIBMI application? | Valid in user-defined routine? |
|---|---|
| No | Yes |
Usage
[owner].xadatasourcename. If the owner is specified,
the mi_xa_get_xadatasource_rmid() function searches
for the owner and the data source name. If the owner is not specified,
the function: - Searches for the XA data source name in a non-ANSI database.
- Adds the current user to the XA data source name when searching an ANSI database.
Multiple registrations of the same XA data source in a transaction have the same effect as a single registration. HCL Informix® does not maintain a count of the number of times an application has registered. A single call to mi_xa_unregister_xadatasource() unregisters the data source from the transaction.
You must be sure that the XA data source was created using this SQL statement:
CREATE XADATASOURCE xadatassourcename USING xads type
For more information about this statement, see the HCL® Informix® Guide to SQL: Syntax.
- Make sure the value for xasrc is correct.
- Make sure that the mi_xa_register_xadatasource() function is called from within the transaction.
- Make sure that the mi_xa_register_xadatasource() function
is not called:
- From the sub-ordinator of a distributed transaction.
- From within a resource manager global transaction.
- 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.
The ax_reg() function also allows modules to register XA-compliant, external data sources. However, the ax_reg() function and the mi_xa_register_xadatasource() function use different parameters and have different return values.
For more information about working with XA data sources, see the HCL® Informix® DataBlade® API Programmer's Guide.
Return values
- MI_OK
- The XA data source is registered.
- MI_ERROR
- An error occurred and the XA data source is not registered.
- MI_NOSUCH_XASOURCE
- The XA data source does not exist in the system.
- MI_INVALID_XANAME
- The user-defined name for an instance of the XA data source is not valid.
- MI_NOTINTX
- The function was called from outside the transaction. The function must be called from within the transaction.
- MI_XAOPEN_ERROR
- The xa_open purpose function of the XA data source returned an error.