当连接变坏时,有没有办法让 JBoss 连接池重新连接到 Oracle?

我们的 JBoss 和 Oracle 位于不同的服务器上.连接似乎已断开并导致 JBoss 出现问题.如果在我们首先找出连接断开的原因时连接不好,我如何让 JBoss 重新连接到 Oracle?

We have our JBoss and Oracle on separate servers. The connections seem to be dropped and is causing issues with JBoss. How can I have the JBoss reconnect to Oracle if the connection is bad while we figure out why the connections are being dropped in the first place?

推荐答案

池上通常有一个配置选项,可以在借用时执行验证查询.如果验证查询成功执行,池将返回该连接.如果查询没有成功执行,池将创建一个新连接.

There is usually a configuration option on the pool to enable a validation query to be executed on borrow. If the validation query executes successfully, the pool will return that connection. If the query does not execute successfully, the pool will create a new connection.

JBoss Wiki 记录了池的各种属性.

The JBoss Wiki documents the various attributes of the pool.

<check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>

似乎应该可以解决问题.

Seems like it should do the trick.

相关文章