如何处理“从读取调用中得到减一"连接到 Amazon RDS Oracle 实例时出错 [英] How to approach a "Got minus one from a read call" error when connecting to an Amazon RDS Oracle instance

查看:21
本文介绍了如何处理“从读取调用中得到减一"连接到 Amazon RDS Oracle 实例时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Amazon RDS 实例上运行 Oracle 11GR2.有时我会在调用 DriverManager.getConnection(getUrl()) 时收到 IO 错误:从读取调用中减去一个,我不知道为什么.其他应用程序正常工作.

I'm running Oracle 11GR2 on an Amazon RDS instance. occasionally I get an IO Error: Got minus one from a read call when making a call to DriverManager.getConnection(getUrl()) and I'm not sure why. Other applications work correctly.

为了进一步混淆事情,错误有时会自行纠正(在程序的下一次迭代之后).

To further confuse things, the error will correct itself on occasion (following next iteration of the program).

我应该如何处理从读取调用中得到减一"错误?

完整的堆栈跟踪:

java.sql.SQLRecoverableException: IO Error: Got minus one from a read call
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:489)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:553)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:254)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)
    at java.sql.DriverManager.getConnection(DriverManager.java:579)
    at java.sql.DriverManager.getConnection(DriverManager.java:243)
    at com.cwd.facile.db.Database.<init>(Database.java:44)
    at com.cwd.facile.ns.NetSuiteRequestBased.<init>(NetSuiteRequestBased.java:29)
    at com.cwd.facile.ns.CommonOperations.isInventoryItem(CommonOperations.java:205)
    at com.cwd.facile.ns.CommonOperations.findItemIdByName(CommonOperations.java:188)
    at com.cwd.facile.ns.CommonOperations.createSalesOrder(CommonOperations.java:970)
    at com.cwd.facile.Main.main(Main.java:47)
Caused by: oracle.net.ns.NetException: Got minus one from a read call
    at oracle.net.ns.Packet.receive(Packet.java:311)
    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:300)
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1140)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:340)
    ... 12 more

Database.java 第 44 行:setConn(DriverManager.getConnection(getUrl()));

Database.java line 44: setConn(DriverManager.getConnection(getUrl()));

其他信息:

  • 我认为这是一个错误的 JDBC url,但它确实有效,有时在失败之前连续几天.
  • Amazon RDS 是托管实例,可能无法更改配置
  • 我使用 ojdbc6.jar 进行连接

推荐答案

问题的直接原因是 JDBC 驱动程序试图从已被另一端"关闭的网络 Socket 中读取数据.

The immediate cause of the problem is that the JDBC driver has attempted to read from a network Socket that has been closed by "the other end".

这可能是由于以下几点原因:

This could be due to a few things:

  • 如果远程服务器已配置(例如在SQLNET.ora"文件中)不接受来自您 IP 的连接.

  • If the remote server has been configured (e.g. in the "SQLNET.ora" file) to not accept connections from your IP.

如果 JDBC url 不正确,您可能正在尝试连接到不是数据库的东西.

If the JDBC url is incorrect, you could be attempting to connect to something that isn't a database.

如果数据库服务打开的连接过多,它可能会拒绝新的连接.

If there are too many open connections to the database service, it could refuse new connections.

鉴于这些症状,我认为最有可能出现连接过多"的情况.这表明您的应用程序正在泄漏连接;即创建连接,然后未能(总是)关闭它们.

Given the symptoms, I think the "too many connections" scenario is the most likely. That suggests that your application is leaking connections; i.e. creating connections and then failing to (always) close them.

这篇关于如何处理“从读取调用中得到减一"连接到 Amazon RDS Oracle 实例时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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