zoukankan      html  css  js  c++  java
  • jboss数据源配置

    http://blog.csdn.net/clinique/article/details/7482670

    最近项目相关的JBOSS配置开始,留下点什么

    项目使用的是local-tx-datasource, 网上找了很多资料,都没有明确说明local-tx-datasource和xa-datasource的区别,而且中文的资料太少,去JBOSS Community 查看了一圈找到了有价值的信息。

    1. local-tx-datasouce 能不能参与JTA事务

    JBOSS Administration_Configuration_Guide上的解释

    <no-tx-datasource>

    Does not take part in JTA transactions. The Java.sql.Driveris used.

    <local-tx-datasource>

    Does not support two phase commit. The java.sql.Driveris used. Suitable for a single database or a non-XA-aware resource.

    <xa-datasource>

    Supports two phase commit. The javax.sql.XADataSourcedriver is used.

    说的比较清楚,local-tx-datasource是可以作为JTA事务参与者的, 只是不支持2PC协议(two-Phase-Commit Protocol)。

    1. 一个Application 能不能定义多个local-tx-datasource数据源,什么时候用xa-datasource

    在Forum上到的讨论结果,JBOSS的开发人员认证了一下说法

    You have to usexa-datasources in cases where onetransaction spans multiple datasources. Regardless of wheter Iuse a cluster or not.

    For example amethod consuming a JMS message and manipulating a JPA Entity.

    对这个说法的解释就是,一个Application可以定义并使用很多个local-tx-datasource数据源,但是一个事务(Transaction)只能操作一个数据源。当你的事务需要同时处理不同的数据源的时候,必须定义为xa-datasource,否则会出现org.jboss.util.NestedSQLException:Could not enlist in transaction on entering meta-aware object 的报错。

  • 相关阅读:
    Cannot attach the file *.mdf as database
    frameset frame 实例和用法 转
    remove element
    伸展树--java
    Remove Duplicates from Sorted Array
    merge two sorted lists
    valid parentheses
    Longest Common Prefix
    palindrome number(回文数)
    Two Sum
  • 原文地址:https://www.cnblogs.com/jiaozi-li/p/7308239.html
Copyright © 2011-2022 走看看