gpt4 book ai didi

Java连接OracleDB : java. sql.SQLRecoverableException: IO error: The pipe has been cut

转载 作者:搜寻专家 更新时间:2023-10-30 20:52:10 24 4
gpt4 key购买 nike

我正在尝试使用 java 通过流动源连接到 Oracle DB (11g):

try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
return;
}

Connection connection = null;

try {
connection = DriverManager.getConnection("jdbc:oracle:thin:@//IP_ADDRESS:1521/SERVCE_NAME", "USER", "PASS");
} catch (SQLException e) {

e.printStackTrace();
return;
}

它在我的旧数据库上运行良好,但在新数据库上运行失败

无法获取连接,错误是:

java.sql.SQLRecoverableException: IO error: The pipe has been cut. at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:752) at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at main.main(main.java:30) Caused by: java.net.SocketException: pipe has been cut. at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) at java.net.SocketOutputStream.write(SocketOutputStream.java:153) at oracle.net.ns.DataPacket.send(DataPacket.java:209) at oracle.net.ns.NetOutputStream.flush(NetOutputStream.java:215) at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:302) at oracle.net.ns.NetInputStream.read(NetInputStream.java:249) at oracle.net.ns.NetInputStream.read(NetInputStream.java:171) at oracle.net.ns.NetInputStream.read(NetInputStream.java:89) at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:123) at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:79) at oracle.jdbc.driver.T4CMAREngineStream.unmarshalUB1(T4CMAREngineStream.java:429) at oracle.jdbc.driver.T4C8TTIdty.receive(T4C8TTIdty.java:706) at oracle.jdbc.driver.T4C8TTIdty.doRPC(T4C8TTIdty.java:613) at oracle.jdbc.driver.T4

CConnection.connect(T4CConnection.java:1607) at oracle.jdbc.driver.T4

CConnection.logon(T4CConnection.java:496) ... 6 more

什么是:java.sql.SQLRecoverableException: IO error: The pipe has been cut 是什么意思?请帮我解决这个错误。

提前致谢。

最佳答案

What is: java.sql.SQLRecoverableException: IO error: The pipe has been cut mean ?

这个问题的答案在 JavaDoc 中给出:

The subclass of SQLException thrown in situations where a previously failed operation might be able to succeed if the application performs some recovery steps and retries the entire transaction or in the case of a distributed transaction, the transaction branch. At a minimum, the recovery operation must include closing the current connection and getting a new connection. (Source JavaDoc )

主要问题可能是您为 Oracle JDBC 驱动程序使用了错误的名称。正确的驱动名称叫做:

oracle.jdbc.OracleDriver

所以用这个替换 oracle.jdbc.driver.OracleDriver

连接url应该如下:

jdbc:oracle:thin:@IP_ADDRESS:1521/SERVCE_NAME

Here您将找到有关如何使用 JDBC 驱动程序的更多详细信息。

关于Java连接OracleDB : java. sql.SQLRecoverableException: IO error: The pipe has been cut,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38714679/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com