Results 1 to 4 of 4

Thread: JTA - XA Datasources

Hybrid View

  1. #1

    Default JTA - XA Datasources

    Should we use XA-Datasources in datasource bean definitions when using JtaTransactionManager as the transaction management strategy.

    What will we gain when using oracle.jdbc.xa.client.OracleXADataSource
    instead of oracle.jdbc.pool.OracleConnectionPoolDataSource
    [/b]

  2. #2
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    There's not much of a reason to use an XA datsource if you don't actually need XA (two phase commit, basically) capabilities, and/or your environment (like the DB) doesn't support XA. So if you only point to one datasource, then you're not going to get anything extra. On the driver side, for example, PostgreSQL JDBC drivers don't currently support XA. So trying to use them in an XA setup would not give you proper two phase commit. On the other hand, if you do have two different datasources (or more), and the drivers and the datasources do support XA, then you will get proper @PC sematics, with proper handling of comit and rollback among the different enlisted datasources.
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  3. #3

    Default

    Thanks for the reply Colin. I will tell you the exact scenario:
    - I have multiple datasources.(Oracle,DB2,AS400)
    - using Spring+Hibernate
    - using JtaTransactionManager as transaction mgm.

    I will define all of 3 datasources in applicationConfig.xml and will define 3 hibernateSessionFactories for them. What I wonder is ,if I use regular DataSources(i.e. oracle.jdbc.pool.OracleConnectionPoolDataSource) for datasource definitions instead of XA DataSources, will Spring be comfortable with this configuration and guarantee the commit,rollback operations when these 3 datasources involved in a distributed transaction.

    Thanks in advance.

  4. #4
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    Well, Spring can't perform magic :-) If you need 2 phase commit, then you need to be using real 2PC capable datasources, and an environment that supports them. So this means JTA + XA capable jdbc drivers plus XA capable databases. It's JTA that's going to coordinate the commits or rollbacks, and it needs the support from the drivers and the dbs. Even if for example you took JTA out of the picture and there was an equivalent 2PC capable TM in spring, it still couldn't do it's work without the capability in the drivers and dbs.
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

Similar Threads

  1. Multiple datasources
    By hucmuc in forum Data
    Replies: 9
    Last Post: Aug 1st, 2007, 10:13 AM
  2. Replies: 1
    Last Post: Jul 17th, 2005, 10:25 PM
  3. Customer Specific DataSources
    By tripperm in forum Data
    Replies: 0
    Last Post: May 9th, 2005, 08:30 PM
  4. Replies: 0
    Last Post: Jan 26th, 2005, 09:28 AM
  5. Replies: 1
    Last Post: Oct 14th, 2004, 07:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •