You are on page 1of 1

Difference between XA and Non-XA Data Sources:

An XA transaction, in the most general terms, is a "global transaction" that may span
multiple resources. A non-XA transaction always involves just one resource.
An XA transaction involves a coordinating transaction manager, with one or more
databases (or other resources, like J!" all involved in a single global transaction. #on-
XA transactions have no transaction coordinator, and a single resource is doing all its
transaction work itsel$ (this is sometimes called local transactions".
XA transactions come $rom the X%&pen group speci$ication on distributed, global
transactions. J'A includes the X%&pen XA spec, in modi$ied $orm.
ost stu$$ in the world is non-XA - a !ervlet or (J) or plain old J*)+ in a Java
application talking to a single database. XA gets involved when you want to work with
multiple resources - , or more databases, a database and a J! connection, all o$ those
plus maybe a J+A resource - all in a single transaction. -n this scenario, you.ll have an
app server like /ebsphere or /eblogic or J)oss acting as the 'ransaction anager, and
your various resources (&racle, !ybase, -) 0 J!, !A1, whatever" acting as
transaction resources. 2our code can then update%delete%publish%whatever across the
many resources. /hen you say "commit", the results are commited across all o$ the
resources. /hen you say "rollback", 3everything3 is rolled back across all resources.
'he 'ransaction anager coordinates all o$ this through a protocol called 'wo 1hase
+ommit (,1+". 'his protocol also has to be supported by the individual resources.
-n terms o$ datasources, an XA datasource is a data source that can participate in an XA
global transaction. A non-XA datasource generally can.t participate in a global transaction
(sort o$ - some people implement what.s called a "last participant" optimi4ation that can
let you do this $or e5actly one non-XA item".
6or more details - see the J'A pages on java.sun.com. 7ook at the XA8esource and Xid
inter$aces in J'A. !ee the X%&pen XA *istributed 'ransaction speci$ication. *o a google
source on "Java J'A XA transaction".

You might also like