IO错误:套接字读取超时.原因是什么? [英] IO Error: Socket read timed out. What are the reasons?
本文介绍了IO错误:套接字读取超时.原因是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的简化代码(该示例说明连接因错误"IO错误:套接字读取超时"而中断):
My simplified code (which demonstrates that the connection breaks with error "IO Error: Socket read timed out"):
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
this.connection = DriverManager.getConnection("jdbc:oracle:thin:@", properties);
while(isStarted){
this.statement = this.connection.createStatement();
ResultSet result = this.statement.executeQuery("select sysdate from dual");
result.next();
System.out.println("Sysdate: " + result.getString(1));
result.close();
this.statement.close();
this.statement = null;
TimeUnit.SECONDS.sleep(4);
}
this.connection.close();
this.connection = null;
4-5个小时后,我赶上了:
after 4-5 hours i catched:
IO Error: Socket read timed out
java.sql.SQLRecoverableException: IO Error: Socket read timed out
at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:886)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1167)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1289)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1491)
at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:406)
原因是什么?如何解决这个问题?
What are the reasons? how to solve this problem?
推荐答案
我遇到了同样的问题.检查您的服务,确认只有OracleServiceXE和Oracle XETNSListener正在运行.
I had the same problem. Check your services and see to it that only OracleServiceXE and Oracle XETNSListener is running.
您可以使用命令
netstat -ano |找到"1521"
netstat -ano | find "1521"
在结果中,最后一列显示PID,它应该是唯一的.如果该命令未返回任何结果,则说明您的监听器未运行.
In the result the last column shows the PID and it should be unique. If the command returns no result then your Listener is not running.
这篇关于IO错误:套接字读取超时.原因是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文