Oracle DB:java.sql.SQLException:已关闭连接 [英] Oracle DB : java.sql.SQLException: Closed Connection

查看:923
本文介绍了Oracle DB:java.sql.SQLException:已关闭连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

java.sql.SQLException的原因:来自Oracle的已关闭连接??

Reasons for java.sql.SQLException: Closed Connection from Oracle??


java.sql.SQLException:已关闭连接
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver。 DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:1131)
at oracle.jdbc.OracleConnectionWrapper.commit(OracleConnectionWrapper.java:117)

java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208) at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:1131) at oracle.jdbc.OracleConnectionWrapper.commit(OracleConnectionWrapper.java:117)

我们从故障转移数据库连接中收到此错误。我们也为其他数据库使用相同的代码。但只与其中一个数据库一起看这个问题。这是因为由于长时间不活动而连接可能会超时,我们正在尝试使用它吗?如果您需要更多详细信息请告诉我...

We are getting this error from the fail over database connection. We use the same code for other databases as well. But seeing this issue with only one of the databases. Is this because the connection might have timeout due to long inactivity period and we are trying to use that? Pls let me know if you need more details...

AbandonedConnectionTimeout设置为15分钟
InactivityTimeout设置为30分钟

AbandonedConnectionTimeout set to 15 mins InactivityTimeout set to 30 mins

推荐答案

这意味着在某些时候成功建立了连接,但是当您尝试在那里提交时,连接不再打开。您提到的参数听起来像连接池设置。如果是这样,他们就与这个问题无关。最可能的原因是您和数据库之间的防火墙在一定量的空闲时间后终止连接。最常见的修复方法是在从中检出连接时使连接池运行验证查询。这将立即识别并驱逐死亡连接,确保您只能从池中获得良好的连接。

It means the connection was successfully established at some point, but when you tried to commit right there, the connection was no longer open. The parameters you mentioned sound like connection pool settings. If so, they're unrelated to this problem. The most likely cause is a firewall between you and the database that is killing connections after a certain amount of idle time. The most common fix is to make your connection pool run a validation query when a connection is checked out from it. This will immediately identify and evict dead connnections, ensuring that you only get good connections out of the pool.

这篇关于Oracle DB:java.sql.SQLException:已关闭连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆