Jeffrey's Sky

          Go with wind
          隨筆 - 14, 文章 - 1, 評(píng)論 - 15, 引用 - 0
          數(shù)據(jù)加載中……

          XA Datasource 與 Non-XA Datasource 區(qū)別

          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 JMS) all involved in a single global transaction. Non-XA transactions have no transaction coordinator, and a single resource is doing all its transaction work itself (this is sometimes called local transactions).


          XA transactions come from the X/Open group specification on distributed, global transactions. JTA includes the X/Open XA spec, in modified form.


          Most stuff in the world is non-XA - a Servlet or EJB or plain old JDBC in a Java application talking to a single database. XA gets involved when you want to work with multiple resources - 2 or more databases, a database and a JMS connection, all of those plus maybe a JCA resource - all in a single transaction. In this scenario, you'll have an app server like Websphere or Weblogic or JBoss acting as the Transaction Manager, and your various resources (Oracle, Sybase, IBM MQ JMS, SAP, whatever) acting as transaction resources. Your code can then update/delete/publish/whatever across the many resources. When you say "commit", the results are commited across all of the resources. When you say "rollback", _everything_ is rolled back across all resources.


          The Transaction Manager coordinates all of this through a protocol called Two Phase Commit (2PC). This protocol also has to be supported by the individual resources.


          In terms of 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 of - some people implement what's called a "last participant" optimization that can let you do this for exactly one non-XA item).


          For more details - see the JTA pages on java.sun.com. Look at the XAResource and Xid interfaces in JTA. See the X/Open XA Distributed Transaction specification. Do a google source on "Java JTA XA transaction".

          posted on 2010-08-27 13:39 Jeffrey Feng 閱讀(4576) 評(píng)論(2)  編輯  收藏 所屬分類: 數(shù)據(jù)庫

          評(píng)論

          # re: XA Datasource 與 Non-XA Datasource 區(qū)別[未登錄]  回復(fù)  更多評(píng)論   

          XA事務(wù)往往是包括多個(gè)數(shù)據(jù)源的全局事務(wù),非XA是單個(gè)數(shù)據(jù)源的。
          2010-08-27 15:27 | Robin

          # re: XA Datasource 與 Non-XA Datasource 區(qū)別  回復(fù)  更多評(píng)論   

          @Robin
          Yes. Agree.
          2010-08-30 13:59 | Jeffrey Feng

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 石城县| 合阳县| 镇原县| 平谷区| 府谷县| 深圳市| 石林| 阿鲁科尔沁旗| 祥云县| 金塔县| 泸定县| 阳春市| 九龙坡区| 房产| 宁陕县| 仙桃市| 大丰市| 华宁县| 永安市| 岗巴县| 鞍山市| 贵定县| 阿尔山市| 潞城市| 沂源县| 宾川县| 交城县| 金堂县| 疏附县| 安义县| 桂林市| 谢通门县| 体育| 乌鲁木齐市| 桐城市| 五原县| 民勤县| 荔波县| 贵阳市| 平邑县| 东平县|