CREATE XADATASOURCE TYPE statement

Use the CREATE XADATASOURCE TYPE statement to create a new XA-compliant data source type and create an entry for it in the sysxasourcetypes system catalog table. This statement is an extension to the ANSI/ISO standard for SQL.

Syntax

(explicit id xat002) xat002 CREATE XADATASOURCE TYPE [IF NOT EXISTS] xa_type ( <Purpose Options>[] )
Element Description Restrictions Syntax
xa_type Name that you declare here for a new XA data source type Must be unique among XA data source type names in the sysxasourcetypes system catalog table Identifier

Usage

The CREATE XADATASOURCE TYPE statement adds an XA-compliant data source type to the database.

The CREATE XADATASOURCE TYPE statement is not supported on secondary servers within a high-availability cluster.

Any user can create an XA data source type, whose owner-naming rules depend on the ANSI-compliance status of the database. Only a database that uses transaction logging can support the X/Open DTP XA Standard.

To create a data source type, you must declare its name and specify purpose functions and purpose values as attributes of the XA source type. Most of the purpose options that follow the source type name associate columns in the sysxasourcetypes system catalog table with the name of a UDR.

If you include the optional IF NOT EXISTS keywords, the database server takes no action (rather than sending an exception to the application) if an XA data source type of the specified name is already registered in the current database.

Both XA data source types and instances of XA data sources are specific to one database. To support distributed transactions, they must be created in each database that interacts with the external XA data source.

The following statement creates a new XA data source type called MQSeries®, owned by user informix.
CREATE XADATASOURCE TYPE 'informix'.MQSeries(
                           xa_flags    = 1,
                           xa_version  = 0,
                           xa_open     = informix.mqseries_open,
                           xa_close    = informix.mqseries_close,
                           xa_start    = informix.mqseries_start,
                           xa_end      = informix.mqseries_end,
                           xa_rollback = informix.mqseries_rollback,
                           xa_prepare  = informix.mqseries_prepare,
                           xa_commit   = informix.mqseries_commit,
                           xa_recover  = informix.mqseries_recover,
                           xa_forget   = informix.mqseries_forget,
                          xa_complete = informix.mqseries_complete);

You need to provide one value or UDR name for each of the options listed above, but the sequence in which you list them is not critical. (The order of purpose options in this example corresponds to the order of column names in the sysxasourcetypes system catalog table.)

After this statement executes successfully, you can create instances of type informix.MQSeries. The following statement creates a new instance called informix.MenloPark of XA-compliant data source type informix.MQSeries:
CREATE XADATASOURCE informix.MenloPark USING informix.MQSeries;