Oracle 9i 会话断开

发布于 2024-08-22 09:18:38 字数 3340 浏览 6 评论 0原文

[来自 ServerFault 的交叉发布]

我处于开发环境中,我们的测试 Oracle 9i 服务器几天来一直表现不佳。发生的情况是,在几次成功的连接后,我们的 JDBC 连接断开了。

我们的 IT 部门设置了这个盒子并移交给了我们。这是“我们的问题”,所以像“问你 DBA”这样的选项对我没有帮助。 :(

我们的服务器设置了 3 个普通数据库(一个是主开发数据库,​​另一个是“实验”开发数据库)。我们使用 Oracle 10 ojdbc14.jar 瘦 JDBC 驱动程序(因为版本 9 中存在一些错误)我们正在使用 Hibernate 与数据库对话,

我看到的唯一变化是我们现在有更多的用户连接到服务器,而不是一个开发人员。使用 Hibernate。连接池,我想也许我们达到了一些限制?

有人知道发生了什么吗?

这是客户端上的堆栈跟踪:

Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126) [hibernate3.jar:na]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114) [hibernate3.jar:na]
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) [hibernate3.jar:na]
at org.hibernate.loader.Loader.doList(Loader.java:2235) [hibernate3.jar:na]
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129) [hibernate3.jar:na]
at org.hibernate.loader.Loader.list(Loader.java:2124) [hibernate3.jar:na]
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401) [hibernate3.jar:na]
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363) [hibernate3.jar:na]
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) [hibernate3.jar:na]
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149) [hibernate3.jar:na]
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) [hibernate3.jar:na]
...
Caused by: java.sql.SQLException: Io exception: Connection reset
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:829) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:854) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3415) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208) [hibernate3.jar:na]
at org.hibernate.loader.Loader.getResultSet(Loader.java:1812) [hibernate3.jar:na]
at org.hibernate.loader.Loader.doQuery(Loader.java:697) [hibernate3.jar:na]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) [hibernate3.jar:na]
at org.hibernate.loader.Loader.doList(Loader.java:2232) [hibernate3.jar:na]

[Cross-Posting from ServerFault]

I am in a development environment, and our test Oracle 9i server has been misbehaving for a few days now. What happens is that we have our JDBC connections disconnecting after a few successful connections.

We got this box set up by our IT department and handed over to. It is 'our problem', so options like 'ask you DBA' isn't going to help me. :(

Our server is set up with 3 plain databases (one is the main dev db, the other is the 'experimental' dev db). We use the Oracle 10 ojdbc14.jar thin JDBC driver (because of some bug in the version 9 of the driver). We're using Hibernate to talk to the DB.

The only thing that I can see that changed is that we now have more users connecting to the server. Instead of one developer, we now have 3. With the Hibernate connection pools, I'm thinking that maybe we're hitting some limit?

Anyone has any idea what's going on?

Here's the stack trace on the client:

Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126) [hibernate3.jar:na]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114) [hibernate3.jar:na]
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) [hibernate3.jar:na]
at org.hibernate.loader.Loader.doList(Loader.java:2235) [hibernate3.jar:na]
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129) [hibernate3.jar:na]
at org.hibernate.loader.Loader.list(Loader.java:2124) [hibernate3.jar:na]
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401) [hibernate3.jar:na]
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363) [hibernate3.jar:na]
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) [hibernate3.jar:na]
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149) [hibernate3.jar:na]
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) [hibernate3.jar:na]
...
Caused by: java.sql.SQLException: Io exception: Connection reset
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:829) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:854) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3415) [ojdbc14.jar:Oracle JDBC Driver version - "10.2.0.4.0"]
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208) [hibernate3.jar:na]
at org.hibernate.loader.Loader.getResultSet(Loader.java:1812) [hibernate3.jar:na]
at org.hibernate.loader.Loader.doQuery(Loader.java:697) [hibernate3.jar:na]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) [hibernate3.jar:na]
at org.hibernate.loader.Loader.doList(Loader.java:2232) [hibernate3.jar:na]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

流心雨 2024-08-29 09:18:38

您在 Java 中使用哪个 JDK? ojdbc14 适用于 JDK 1.4 及更早版本。对于您的数据库来说,此版本可能存在错误,但如果您使用的是 JDK 5 或 6,我建议您找到适合您的 JDK 的 JDBC 驱动程序版本。 JAR 名称会以某种方式指示 JDK 5 或 6。

Google 搜索发现了来自 Oracle 论坛的此帖子。查看 Oracle 日志,看看是否有与该线程中引用的消息类似的消息。

Which JDK are you using for Java? ojdbc14 is intended for JDK 1.4 and earlier. There might be a bug in this version for your database, but if you're using JDK 5 or 6 I'd recommend finding a version of the JDBC driver for your JDK. The JAR name would indicate JDK 5 or 6 in some way.

A Google search turned up this thread from the Oracle forums. Take a look at the Oracle logs and see if there's a message similar to the one quoted in that thread.

羁绊已千年 2024-08-29 09:18:38

我对 Oracle 和其他数据库也有类似的问题。当数据库服务器关闭连接(例如通过超时)时会发生这种情况。您可以使用连接池(例如c3p0)轻松处理这种情况。另请参阅此处此处

以防万一,我的 c3p0.properties 文件如下所示:

c3p0.preferredTestQuery=SELECT 1 from dual
c3p0.maxConnectionAge=3600
c3p0.testConnectionOnCheckout=true
c3p0.acquireRetryDelay=1000
c3p0.acquireRetryAttempts=30
c3p0.breakAfterAcquireFailure=false

I had similar issue with Oracle and other databases. It happens when db server close connection (e.g. by timeout). You could easily handle the situation with connection pool (e.g. c3p0). See also here and here.

Just in case, my c3p0.properties file looks like:

c3p0.preferredTestQuery=SELECT 1 from dual
c3p0.maxConnectionAge=3600
c3p0.testConnectionOnCheckout=true
c3p0.acquireRetryDelay=1000
c3p0.acquireRetryAttempts=30
c3p0.breakAfterAcquireFailure=false
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文