The Derby embedded driver provides XA support. This project will extend XA support to Network Server. Network Server will be enhanced to provide DRDA XAMGR level 7 support so that DRDA clients supporting XAMGR level 7 can send XA requests to Network Server. Initial testing will be done with the IBM DB2 Universal JDBC driver using the com.ibm.db2.jcc.DB2XADataSource to get XA Connections.


The XAMGR level 7 support is described in the XAMGROV section of the Distributed Data Management Architecture Specification DRDA V3, Vol 3. http://www.opengroup.org/publications/catalog/c045.htm. Other relevant sections are XAMGR, XID, XAFLAGS, XIDCNT, SYNCCTL SYNCCRD and PRPHRCLST.

DRDA support is based on The XA+ Specification, also available from the Open Group at http://www.opengroup.org/publications/catalog/s423.htm .

Below is a excerpt from the XAMGROV section of the DDM Specification which Network Server will support.

DDM Transactional Processing Support

XAMGR level 7 is a manager object of DDM that provides a connection architecture that will

allow the application to perform the operations involved in protecting a DRDA resource. The

DRDA functionality is summarized below:


The following elements of the XAMGR level 7 support will not be supported by Network Server at this time .

Usage with the DB2 Universal JDBC Driver

XA support for Network Server can be accessed using the DB2 Universal JDBC Driver's XA DataSource (com.ibm.db2.jcc.DB2XADataSource).

An example of obtaining an XA connection with the DB2 Universal JDBC Driver.

XAConnection xaConnection = null;
Connection conn = null;

String driver = "com.ibm.db2.jcc.DB2DataSource”;
DB2XADataSource ds = new DB2XADataSource();

ds.setDatabaseName(dbname + ";create=true");




ds.setDriverType(4); // Network Server requires JDBC type 4 driver


xaConnection = ds.getXAConnection("auser", "shhhh");

connection = xaConnection.getConnection();


ij currently has unpublished syntax that is used solely for XA testing. This support will be extended to support Network server so that tests develeloped using the ij xa syntax can be used for network server testing.

Ij will support the framework property setting DerbyNet to indicate that the test should be run against Network Server. Since this support is just for testing, ij will always connect to localhost, port 1527 with the xa_datasource command.

An example usage of ij will be as follows:

java –Dframework=DerbyNet org.apache.derby.tools.ij

ij> xa_datasource ‘wombat’;

ij> xa_connect;
ij> xa_start xa_noflags 1;


IBM DB2 Universal JDBC Driver.

Some changes may be required for the IBM DB2 Universal JDBC Driver, so XA support may require a later version than 2.4

javax.transaction.xa package

In order to use the Network Server XA functionality, the server must be running with a jdk with javax.transaction.xa suppport so will not be supported in JSR 169 configurations.


Existing embedded XA tests will be run against Network Server.


Changes to support XA connections should not affect performance of non-XA connections. XA performance will be measured in comparison to embedded performance to ensure that Network XA Connections do not have a significant performance impact. We will compare to embedded to ensure that the XA performance ratio embedded/network server is comparable to to the tests with non-XA connections.

Design Overview

We will add two new classes to org.apache.derby.drda.

Other changes will include adding an isXARequester() to the AppRequester, adding the new Codepoints and SYNCCTL values to the Codepoint class and other miscellaneous support.

Note, The one flag that does not seem to be defined for DRDA is XAResource.TMONEPHASE. Currently JCC sends XAResource.TMONEPHASE in the event of a one phase commit, and Network Server recognizes this, but it is not clear whether this is standard.