The mi_xa_unregister_xadatasource() function

The mi_xa_unregister_xadatasource() function unregisters the previously registered XA data source from the transaction.

Syntax

mi_integer mi_xa_unregister_xadatasource(mi_string *xasrc)
xasrc
The user-defined name of the XA data source.

Usage

Because the mi_xa_unregister_xadatasource() function unregisters the data source from the transaction, none of the transactional events that the data source would have instigated occur.

The format of the xasrc name is [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. Since HCL OneDB™ 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.

If you receive an error, check for any of the following problems:
  1. Make sure the value for xasrc is correct.
  2. Make sure that the mi_xa_unregister_xadatasource() function is called from within the transaction.
  3. Make sure that the mi_xa_unregister_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.
  4. Make sure that you are not unregistering an XA data source that is not registered.

The ax_unreg() function also allows DataBlade® modules to unregister XA-compliant, external data sources. However, the ax_unreg() function and the mi_xa_unregister_xadatasource() function use different parameters and have different return values.

For more information about working with XA data sources, see the HCL OneDB DataBlade API Programmer's Guide.

Return values

MI_OK
The data source is unregistered.
MI_ERROR
An error occurred and the data source was not unregistered.
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.