Dashboard > Public Content > ... > JavaStuff > Proper XA Transactions With Oracle and Spring
  Public Content Log In   View a printable version of the current page.  
  Proper XA Transactions With Oracle and Spring
Added by James Richardson, last edited by James Richardson on Apr 11, 2008  (view change)
Labels: 
(None)

Whats this all about?

There are a load of places on the internet that give partial solutions to this common problem: XA Transactions, outside an application container. Here's an attempt to put them all in one place.

Context

This uses the following technologies.

  • Oracle
  • Bitronix Transaction Manager
  • Spring

Selecting the correct oracle drivers

You will need to use the 11.1.0.6.0 11g drivers. These are suitable for previous versions of oracle.

Previous 10.x version of the drivers have a connetion/resource leak which will bite when you use XA.

Configuring Oracle for XA Transactions

Oracle out-of-the-box does not come configured suitable for XA transactions. You need to run the following as a SYS user.

Setting up the transaction manager

Setting up the data source

Sweet!

Actually that's it.

The "allowLocalTransactions" setting means that you can do stuff outside a global transaction. This isn't really recommended, but will work.

Using all this inside tests.

You must remember to destroy your application context each time you create it. Otherwise the transaction manager will grumble at being created multiple times.

Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.1 Build:#806 May 06, 2007) - Bug/feature request - Contact Administrators