简体   繁体   English

在 Java EE 容器管理的事务中使用 Oracle DB 链接的 XA 数据源

[英]XA Datasource using Oracle DB links in Java EE Container managed transactions

I have following environment:我有以下环境:

EAR application on WebSphere 9, container managed transactions using XA datasource for Oracle 19c database (let's name it database "A"). WebSphere 9 上的 EAR 应用程序,使用 XA 数据源的容器管理事务,用于 Oracle 19c 数据库(我们将其命名为数据库“A”)。

The problem is that datasource (in some transactions), ie database "A" is calling database "B" via database link (database "B" is also Oracle 19c).问题在于数据源(在某些事务中),即数据库“A”通过数据库链接调用数据库“B”(数据库“B”也是 Oracle 19c)。

Connection pool gets "Too many database links in use" error message because of 2 phase commit.由于 2 阶段提交,连接池收到“正在使用的数据库链接过多”错误消息。 Let's say max.让我们说最大。 number of database links in use is 4, if i refresh screen 5th time i get SQL exception.正在使用的数据库链接数为 4,如果我第 5 次刷新屏幕出现 SQL 异常。

Setting maximum database links in use parameter in database properties only delays the problem.在数据库属性中设置最大数据库链接使用参数只会延迟问题。

I am in no control (from application perspective) of closing database links.我无法控制(从应用程序的角度)关闭数据库链接。

ATM we've set datasource to non-XA and everything works fine, but in some time we'll need to manualy handle transaction that include one datasource and WebSphere MQ. ATM 我们已经将数据源设置为非 XA 并且一切正常,但是在某些时候我们需要手动处理包含一个数据源和 WebSphere MQ 的事务。

Anyone got any ideas or experience with this setup?有人对此设置有任何想法或经验吗?

EDIT: I'm trying to get this working with JPA 2.0.编辑:我试图让它与 JPA 2.0 一起工作。

You have two options:您有两个选择:

  1. If not you, then the developers of the application need to make sure the database links get closed.如果不是您,那么应用程序的开发人员需要确保关闭数据库链接。 If your max number of active database links is 4, then you can only have 4 active sessions/users in your application.如果您的最大活动数据库链接数为 4,那么您的应用程序中只能有 4 个活动会话/用户。
  2. Increase the allowed number of database links增加允许的数据库链接数

This article describes the fixes/workarounds in greater detail. 本文更详细地介绍了修复程序/解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM