- 浏览: 1608419 次
- 性别:
- 来自: 厦门
文章分类
- 全部博客 (603)
- T_java (145)
- T_script&ASP (51)
- T_C/C++ (25)
- T_PowerBuilder (11)
- T_Database (53)
- T_odoo (7)
- T_应用服务器 (50)
- T_专_条形码 (6)
- T_专_负载均衡器 (4)
- T_操作系统 (94)
- T_信息安全 (41)
- T_专_搜索引擎 (14)
- T_L_PHP (58)
- T_L_Delphi (18)
- T_L_.NET、C#、VisualStudio (25)
- T_L_Objective-C (6)
- T_移动开发 (53)
- T_网络 (109)
- T_大数据 (2)
- T_嵌入式 (2)
- T_小众技术 (24)
- T_未分类 (58)
- L_旅游印记 (1)
- L_生活随笔 (48)
- L_中国文化 (18)
- L_户外与生存 (0)
最新评论
-
csbean4004:
不知道哪传来得恶习,发帖子不好好发,故意弄错一些东西,很讨厌
让HTML5支持后置摄像头 -
withthewind:
终于找到一个可以用的了。。。
如何用VBA取得Word文档中的标题前面的序号 -
busbby:
兄弟,无法下载,说文件不完整
一个好用的Outlook ost格式文件转pst文件的工具 -
yijavakevin:
密码啊~解压密码多少?
一个二维条形码组件 -
vipbooks:
你给的那个链接根本无法下载,跳到官网看了下最新版12M,但点下 ...
十步以内完成精细web打印
/*
这篇JTA问答问题都很经典,回答也十分言简意赅。通过问答将XA driver与non-XA driver在分布式事务中的使用注意事项讲述的很清楚,解决了我原先的一些困惑。现把原文贴出来,希望对大家有所助益。
*/
1. Can I use a non-XA driver in distributed transactions?
我能在分布式事务中使用非XA驱动吗?
When the non-XA connection pool is the only resource participating in a transaction distributed across multiple servers, you just need to configure a TxDataSource for the non-XA driver. (This configuration is the same as the JTS driver usage in WLS 5.1.)
当非XA连接池是分布在多个server中的唯一的资源时,你仅仅需要为非XA驱动配置TxDataSource。
However, when more than one resource participates in the distributed transaction, you must also set the TxDataSource property EnableTwoPhaseCommit=true. For more information, see Managing JDBC Connectivity in the Administration Guide. In both cases, always obtain a connection via the DataSource interface, not through the deprecated DriverManager interface. If you obtain a connection via DriverManager, the interface cannot pick up the EnableTwoPhaseCommit setting of the TxDataSource; this may result in unexpected behavior in distributed transactions. Also, when you use the DataSource interface, you do not need to distinguish either the URL or the specific WebLogic multitier driver (JTS, RMI, or pool.) The URL and specific driver are obtained through the config.xml file and JNDI lookup.
然而,当在分布式事务中超过一个参与的资源时,你必须设置TxDataSource属性“EnableTwoPhaseCommit=true”。更多信息参见在管理指南中的管理JDBC连接。在所有的情况下,经常通过DataSource接口获得连接,不通过DriverManager接口。如果你通过DriverManager获得了一个连接,接口不能获得TxDataSource的“EnableTwoPhaseCommit”的设置;这可能导致在分布式事务中不希望的行为。所以,当你使用DataSource接口,你不需要区别URL或特定的WebLogic驱动(JTS,RMI或池)。URL和特定的驱动通过config.xml文件和JNDI查找获得。
2. Can I use more than one non-XA connection pool in distributed transactions? 在分布式事务中,我能使用超过一个的非XA连接池吗?
No. Even if you set EnableTwoPhaseCommit=true for both TxDataSources of the connection pools, attempting to use two non-XA connection pools in the same distributed transaction will result in
"java.sql.SQLException: Connection has already been created in this tx context for pool named <first pool’s name>. Illegal attempt to create connection from another pool: <second pool’s name>"
when you attempt to get the connection from the second non-XA connection pool.
不能。即使你为所有的这些连接池都设置了EnableTwoPhaseCommit=true,在同一个分布式事务中尝试使用两个非XA连接池会导致“java.sql.SQLException:Connection has already been created in this tx context for pool named <first pool’s name>.Illegal attempt to create connection from another pool:<second pool’s name>”这样的异常。当你试图从第二个非XA连接池获得连接时,你会得到以上的异常。
3. How do XA and non-XA drivers differ in distributed transactions?
XA驱动和非XA驱动在分布式事务中的区别是什么?
The differences between XA and non-XA JDBC drivers are:
XA和非XA的JDBC驱动是:
Atomicity Guarantee. An XA driver implements the XAResource interface and can participate fully in the 2PC protocol driven by the WLS Transaction Manager. This guarantees atomicity of updates across multiple participating resources.
原子保证。XA驱动实现XAResource接口并且能通过WLS事务管理器在2PC协议驱动间完全分享。多个一同参与的资源保证原子级更新。???
However, a non-XA driver does not implement the XAResource interface and cannot fully participate in the 2PC protocol. When using a non-XA driver in a distributed transaction, WLS implements the XAResource wrapper on behalf of the non-XA driver. If the data source property EnableTwoPhaseCommit is set to true, then the WLS XAResource wrapper returns XA_OK when the Transaction Manager calls prepare on it. When the Transaction Manager calls commit or rollback on it during the second phase, the WLS XAResource wrapper delegates the commit/rollback call to the non-XA JDBC connection. Any failure during commit/rollback results in heuristic exceptions. Application data may be left in an inconsistent state as a result of heuristic failure.
非XA驱动没有实现XAResource接口,不能完全的在2PC(tow phase commit 译者注)协议间分享。当在分布式事务中使用一个非XA驱动时,WLS代表非XA驱动实现XAResource wrapper。如果DataSource属性“EnableTwoPhaseCommit”被设置为true,当事务管理器调用prepare时,WLS XAResource wrapper返回XA_OK。当事务管理器在第二个阶段中调用commit或rollback时,WLS XAResource wrapper代理commit/rollback调用到非XAJDBC连接。在commit/rollback过程中的任何失败都会导致heuristic exception(启发式异常?)。作为启发式失败的结果,应用数据可能会保留在一种不一致的状态。
Redirecting Connections. As in WLS 5.1, a non-XA driver can be configured to perform updates in the same distributed transaction from more than one process, as explained in Can I use a non-XA driver in distributed transactions?. WLS internally redirects the JDBC calls made from different processes to the same physical JDBC connection in one process. However, when you use a XA driver, no such redirection will be done. Each process will use its own local XA database connection, and the database ensures that all the distributed updates made in the same distributed transaction from different processes will be committed atomically.
重定向连接。在WLS 5.1中,非XA驱动能被配置执行在相同的分布式事务中更新。WLS内部重定向JDBC调用由不同过程到过程中的相同物理JDBC连接。然而,当你使用XA驱动时,没有这样的重定向会产生。每个过程会使用自己的本地XA数据库连接,并且数据库确保所有的分布式更新在同一个分布式事务中产生,从不同的处理会被原子化提交。
Connection Management. Whether you are using the non-XA driver or XA driver in distributed transactions, WLS implements JDBC wrappers that intercept all the JDBC calls and obtains a physical JDBC connection from the connection pool on demand.
连接管理。无论是否你正在分布式事务中使用非XA驱动或者XA驱动,WLS实现JDBC wrappers来截获所有的JDBC调用并且获得一个物理JDBC连接从连接池中按需要获取。
When you use a non-XA driver in distributed transactions, in order to ensure that updates made from different processes are committed atomically, WLS associates the same physical JDBC connection with the distributed transaction until it is committed or rolled back. As a result, the number of active distributed transactions using the non-XA connection pool is limited by the maximum capacity of the JDBC connection pool.
当你在分布式事务中使用非XA驱动,为了确保更新从不同的进程被原子化提交完成,WLS联系相同的物理JDBC连接和分布式事务,直到他被commit或rollback。作为结果,活动的分布式事务的数量使用非XA连接池被JDBC连接池的最大容量所限制。
When you use an XA driver, the connection management is more scalable. WLS does not hold on to the same physical XA connection until the transaction is committed or rolled back. In fact, in most cases, the XA connection as only held for the duration of a method invocation. WLS JDBC wrappers intercept all JDBC calls and enlist the XAResource associated with the XA connection on demand. When the method invocation returns to the caller, or when it makes another call to another server, WLS delists the XAResource associated with the XA connection.
当你使用XA驱动,连接管理是更可升级的。WLS在事务被提交或回滚前不持有相同的物理XA连接。事实上,大多数情况中,XA连接仅仅持续在方法调用期。WLS JDBC wrappers拦截所有的JDBC调用和按需要调配和XA连接联系的XAResource。当方法调用返回到调用者,或当它产生另外一个调用到另外的服务器,WLS划掉和XA连接管理的XAResource。
WLS also returns the XA connection to the connection pool on delistment if there are no open result sets. Also, during commit processing, any XAResource object can be used to commit any number of distributed transactions in parallel. As a result, neither the number of active distributed transactions using the XA connection pool nor the number of concurrent commit/rollbacks is limited by the maximum capacity of the connection pool. Only the number of concurrent database access connections is limited by the maximum capacity of the connection pool.
WLS也返回在划掉清单上的XA连接到连接池,如果没有打开的结果集。然而,在提交处理过程中,任何XAResource对象能被用于并行提交任意数量的分布式事务。作为结果,既没有活动分布事务使用XA连接池的数量,也没有并发的commit/rollback被连接池的最大能力所限制的数量。只有并发数据库访问连接的数量被限制,由连接池的最大能力。
4. What XA drivers can I use in addition to the WebLogic jDriver for Oracle/XA? 除了WebLogic jDriver for Oracle/XA驱动外还可以使用什么XA驱动?
Theoretically, you can use any third party XA driver that is compliant with the JDBC 2.0 standard extension specification with WLS. However, an individual vendor’s XA driver may have bugs that prevent it from working properly.
理论上,你可以使用任何兼容JDBC2.0标准的为WLS扩展的第三方的XA驱动。然而,独立的XA驱动提供商可能有一些bug妨碍正常工作。
Refer to JDBC Configuration guidelines for details about how to configure them at ../adminguide/managetx.html.
5. Can I use the Oracle thin driver as an XA driver in distributed transactions?
我能使用Oracle thin driver作为分布式事务中的XA驱动吗?
Oracle 8.1.6 thin driver has a bug that does not accept any foreign Xid, and so does not work at all with any other vendor’s transaction manager, including WLS.
Oracle8.1.6 thin driver有bug,不接收如何外部的Xid,并且因此不能和任何其他提供商的事务管理器协同工作,也包括 WLS。
Oracle 8.1.7 thin driver has threading problems and we do not recommend using it at this point. A workaround is not yet available in SP1. It will be available in the Silversword release. For this workaround, we use a dedicated XA connection for the duration of prepare, commit, and rollback operation. This is different from the default XA connection management model (see FAQ 3 for description) in that any XAResource object is used to commit any number of transactions in parallel. This limits the number of concurrent commits to the max capacity of the XA connection pool. Note that this workaround is an Oracle specific workaround and will not affect the usage of other XA drivers.
Oracle8.1.7 thin driver有线程问题,并且我们不建议使用。会在Silversword发布时可用。对这种情况,我们使用专门的XA连接在prepare,commit,rollback操作。这与默认的XA连接管理模型不同。这限制了并发提交的数量因为XA连接池的最大容量。注意这是oracle特有的情况,不会影响到其他XA驱动。
Meanwhile, if you still want to try it out in SP1 without the workaround, you can configure the XA connection pool. For more information, see Managing JDBC Connectivity in the Administration Guide.
期间,如果你仍然想试用SP1,你可以配置XA连接池。要获得更多的信息,参见在管理指南中的管理JDBC连接。
6. Why do I get SQLException "Result set already closed" message?
为什么我会获得SQLException "Result set already closed"
Problem: I am using Weblogic jDriver for Oracle/XA (transaction mode) from the client side. Updating in a distributed transaction works fine. However, when I try to perform a query, I get SQLException Result set already closed. How do I work around this?
问题:我正试用WebLogic JDriver for Oracle/XA(事务模式)从客户端。更新一个分布式事务工作的很好。然而当我要执行一个查询,我得到了这个SQLexception,我应该怎么作?
Weblogic jDriver for Oracle has a limitation that closes all open result sets when the method returns to the caller. For more information, see Limitations of the Weblogic jDriver for Oracle XA in Using WebLogic jDriver for Oracle/XA in Distributed Transations.
Weblogic jDriver for Oracle有一个限制,那就是当方法返回到调用者时会关闭所有的结果集。
Using the driver from the server side, for example, in a bean, does not have this limitation. Using the driver from the server side is also recommended from application architecture and performance perspective. Using the driver from the client side incurs round-trip cost for every JDBC call being made.
从服务端使用这个驱动,例如在bean中,没有这个限制。从服务端使用驱动也是应用架构和性能方面所推荐的。从客户端使用驱动导致了每个JDBC调用产生往返成本。
This limitation exists because Weblogic jDriver for Oracle XA is implemented using Oracle’s OCI API and C XA switch, and there is an Oracle problem when using OCI with XA in multi-threaded mode. Closing an OCI cursor in a thread that is different than the thread in which it is opened may result in server crash or unexpected behavior. As a result, the Weblogic driver implicitly closes all open result sets upon returning a call to the caller.
存在这个限制是因为WebLogic jDriver for Oracle XA是使用Oracle的OCI和C XA交换的实现,当使用OCI 和XA在多线程模式时Oracle存在问题。在线程中关闭OCI比在线程中打开有不同会导致服务器崩溃或出现不希望的行为。因为这个原因,WebLogic driver隐含关闭所有打开的结果集,一旦返回调用到调用者。
7. Do I need a 2PC license when I use JMS with one JDBC non-XA driver?
当我使用JMS和JDBC非XA驱动时,我需要2PC许可吗?
Yes, you do. JMS is also a XAResource that participates in the distributed transaction. Therefore, there are two resources participating in the distributed transaction, and a 2PC license is needed.
是的,你需要。JMS也是一种参与分布式事务的XAResource。因而,有两个资源参与分布式事务,并且2PC的license也需要。
8. Why am I getting an exception when I use JMS with a non-XA driver?
为什么我得到了一个异常,当我使用非XA驱动的JMS?
Problem: I am using JMS with one JDBC non-XA driver. Transaction fails to commit with the following exception: javax.transaction.xa.XAException: JDBC driver does not support XA, hence cannot be a participant in two-phase commit.
问题:我正使用JMS with one JDBC non-XA驱动。事务提交失败,产生下面的异常:”javax.transaction.xa.XAException: JDBC driver does not support XA, hence cannot be a participant in tow-phase commit.”
As mentioned in the previous question Do I need a 2PC license when I use JMS with one JDBC non-XA driver?, JMS is also a XAResource that participates in the distributed transaction. When more than one resource is participating in the distributed transaction, you need to set the data source property EnableTwoPhaseCommit=true as explained in " Can I use a non-XA driver in distributed transactions?"
根据在上面问题的提示,我需要2PC许可当使用JMS with one JDBC non-XA driver? ,JMS也是一种参与分布式事务的XAResource。当超过一个资源参与分布式事务时,你需要设置数据源属性 “EnableTwoPhaseCommit=true”。
9. Why do I get an exception when I use EJB CMP 1.1?
为什么当我使用EJB CMP 1.1时会产生异常?
Problem: I am using distributed transactions with EJB CMP 1.1 and a non-XA connection pool. I configured the JDBC connection pool and the TxDataSource according to instructions in Can I use a non-XA driver in distributed transactions?. However, commit still gives javax.transaction.xa.XAException: JDBC driver does not support XA, hence cannot be a participant in two-phase commit. Why?
问题:我正在使用分布式事务 EJB CMP 1.1和非XA连接池。我配置JDBC连接池和TxDataSource 依据指示。然而,commit仍然给出了 “javax.transaction.xa.XAException: JDBC driver does not support XA, hence cannot be a participant in two-phase commit.”
The old style CMP 1.1 DTD does not allow you to specify the data source name. When only the connection pool name is specified, the EnableTwoPhaseCommit setting of the TxDataSource is ignored. You should use the new style CMP 1.1 DTD and specify the data source name instead of the pool name.
旧格式CMP1.1 DTD不允许你指定数据源名字。当只有连接池的名字被指定时,TxDataSource的EnableTwoPhaseCommit设置被忽略。你应该使用新格式的CMP1.1DTD并且指定数据源的名字而不是连接池的名字。
To ensure that the descriptor is using the latest DTD file, verify that the DOCTYPE header for the WebLogic CMP 1.1 descriptor file is as follows:
要确认你是否使用的是最新的DTD文件,从WebLogic CMP1.1描述符中验证下面的DOC TYPE头:
<!DOCTYPE weblogic-rdbms-jar PUBLIC ‘-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB 1.1 RDBMS Persistence//EN’http://www.bea.com/servers/wls600/dtd/weblogic-rdbms11-persistence-600.dtd’>
To see the DTD file, go to http://www.bea.com/servers/wls600/dtd/weblogic-rdbms11-persistence-600.dtd.
10. Can I obtain a JDBC connection before I start a distributed transaction?
在我启动一个分布式事务前我能获得一个JDBC连接吗?
This depends on whether you are using a non-XA or XA driver.
这取决于你使用的是非XA驱动还是XA驱动。
When you use a non-XA driver in a distributed transaction, always obtain a JDBC connection after the distributed transaction is begun.
当在分布式事务中你使用非XA驱动时,经常在分布式事务被开始后获得JDBC连接。
If you are using an XA driver, you can obtain the connection before the distributed transaction is begun.
如果你使用的是XA驱动,你可以在分布式事务开始前获得连接。
11. Can I close a JDBC connection after the distributed transaction is committed or rolled back? 我能关闭JDBC连接在分布式事务被提交或回滚后?
For both non-XA and XA driver, you can close the connection after the distributed transaction is completed.
对所有的非XA和XA驱动,你可以关闭连接,在分布式事务完成后。
http://edocs.bea.com/wls/docs60/faq/transactions.html
相关推荐
基于springboot个人公务员考试管理系统源码数据库文档.zip
bimdata_api_client-4.2.1-py3-none-any.whl
numpy-1.20.2-cp39-cp39-linux_armv7l.whl
matplotlib-3.3.2-cp39-cp39-linux_armv7l.whl
bimdata_api_client-4.0.0-py3-none-any.whl
ta_lib-0.5.1-cp312-cp312-win32.whl
基于springboot的非学勿扰学习交流平台源码数据库文档.zip
基于springboot云平台的信息安全攻防实训平台源码数据库文档.zip
pillow-10.4.0-cp311-cp311-linux_armv7l.whl
论文描述:该论文研究了某一特定领域的问题,并提出了新的解决方案。论文首先对问题进行了详细的分析和理解,并对已有的研究成果进行了综述。然后,论文提出了一种全新的解决方案,包括算法、模型或方法。在整个研究过程中,论文使用了合适的实验设计和数据集,并进行了充分的实验验证。最后,论文对解决方案的性能进行了全面的评估和分析,并提出了进一步的研究方向。 源码内容描述:该源码实现了论文中提出的新的解决方案。源码中包含了算法、模型或方法的具体实现代码,以及相关的数据预处理、实验设计和性能评估代码。源码中还包括了合适的注释和文档,以方便其他研究者理解和使用。源码的实现应该具有可读性、可维护性和高效性,并能够复现论文中的实验结果。此外,源码还应该尽可能具有通用性,以便在其他类似问题上进行进一步的应用和扩展。
基于springboot+web的学生作业管理系统源码数据库文档.zip
论文描述:该论文研究了某一特定领域的问题,并提出了新的解决方案。论文首先对问题进行了详细的分析和理解,并对已有的研究成果进行了综述。然后,论文提出了一种全新的解决方案,包括算法、模型或方法。在整个研究过程中,论文使用了合适的实验设计和数据集,并进行了充分的实验验证。最后,论文对解决方案的性能进行了全面的评估和分析,并提出了进一步的研究方向。 源码内容描述:该源码实现了论文中提出的新的解决方案。源码中包含了算法、模型或方法的具体实现代码,以及相关的数据预处理、实验设计和性能评估代码。源码中还包括了合适的注释和文档,以方便其他研究者理解和使用。源码的实现应该具有可读性、可维护性和高效性,并能够复现论文中的实验结果。此外,源码还应该尽可能具有通用性,以便在其他类似问题上进行进一步的应用和扩展。
基于springboot网上书店源码数据库文档.zip
numpy-2.1.3-cp311-cp311-linux_armv7l.whl
基于springboot的校园消费点评系统源码数据库文档.zip
ta_lib-0.5.1-cp37-cp37m-win32.whl
Java高校学生信息管理系统源码 一、源码介绍 高校学生信息管理系统设计主要应用JAVA语言编程和mysql数据库连接等相关知识,需要熟练掌握Struts2、Spring、Hibernate基础 二、主要功能 高校学生信息管理系统设计主要应用JAVA语言编程和mysql数据库连接等相关知识,需要熟练掌握Struts2、Spring、Hibernate基础,将所 学知识在生活中灵活运用,高校学生信息管理系统的主要设计功能如下: (1)学生信息管理模块:包括所有学生信息的查询(用分页列表显示)、查看某个学生的详细信息、删除某学生信息、修改某学生信息以及学生信息的录入等子功能 (2)学生成绩管理模块:包括成绩信息录入、学生成绩查询、查看某个学生的成绩表以及删除学生
opencv_python-4.4.0.42-cp39-cp39-linux_armv7l.whl
基于springboot扶贫助农系统源码数据库文档.zip
论文描述:该论文研究了某一特定领域的问题,并提出了新的解决方案。论文首先对问题进行了详细的分析和理解,并对已有的研究成果进行了综述。然后,论文提出了一种全新的解决方案,包括算法、模型或方法。在整个研究过程中,论文使用了合适的实验设计和数据集,并进行了充分的实验验证。最后,论文对解决方案的性能进行了全面的评估和分析,并提出了进一步的研究方向。 源码内容描述:该源码实现了论文中提出的新的解决方案。源码中包含了算法、模型或方法的具体实现代码,以及相关的数据预处理、实验设计和性能评估代码。源码中还包括了合适的注释和文档,以方便其他研究者理解和使用。源码的实现应该具有可读性、可维护性和高效性,并能够复现论文中的实验结果。此外,源码还应该尽可能具有通用性,以便在其他类似问题上进行进一步的应用和扩展。