XA transactions are 2-phase transactions normally used to manage and maintain transaction in a distributed environment. Adapters can be configured for global transactions, if they support the JCA transaction contract. In my first blog lets see how technology adapter (DB Adapter) can be configured to participate in global transaction of BPEL.
Environment: Oracle JDeveloper 10.1.3.2
Integration Server: Oracle SOA Suite 10.1.3.1.0
A BPEL is in place that invoke two DB Adapters, one to debit and another to credit an account. The debit and credit should happen as a single unit of work. These adapters uses different database and hence different datasources. Follow steps below to create datasources -
Oracle JDBC drivers are already available in application server as shared library "oracle.jdbc". If you are going to use third party database, then add the jdbc drivers as shared library. Go to oc4j home > Administration > Shared Libraries and add all jdbc jars.
Integration Server: Oracle SOA Suite 10.1.3.1.0
A BPEL is in place that invoke two DB Adapters, one to debit and another to credit an account. The debit and credit should happen as a single unit of work. These adapters uses different database and hence different datasources. Follow steps below to create datasources -
Oracle JDBC drivers are already available in application server as shared library "oracle.jdbc". If you are going to use third party database, then add the jdbc drivers as shared library. Go to oc4j home > Administration > Shared Libraries and add all jdbc jars.

Under "Applications Importing This Shared Library" section various applications are listed. Applications "ascontrol" and "default" are importing this library to allow us to test the connection of the datasource from the console. Import the shared library to "ascontrol" and "default" by manually adding the entries in "orion-application.xml" and "application.xml" respectively. These files can be found in -
\j2ee\home\application-deployments\ascontrol
\j2ee\home\config
Go to oc4j home > Administration > JDBC Resources and create a new connection pool. Make sure to use a XA datasource as shown in the image below. For Oracle, XA datasource class is - oracle.jdbc.xa.client.OracleXADataSource

Now create a managed datasource and select the newly created connection pool for default application. Provide a jndi name for the datasource like "jndi/OracleDataSource" and make sure to set transaction level as "Global & Local Transactions".
Till now shared library and datasource are established. Now modify the DB adapter deployment descriptor file "oc4j-ra.xml" to add the following entry -

Also import the shared library "oracle.jdbc" in oc4j-ra.xml.





Test the bpel process such that second adapter throws a fault. The account debit done by first adapter should rollback.