mycat->oracle报java.sql.SQLException: 无法从套接字读取更多的数据

今天下午,测试环境运行的时候又出现了之前的一个异常,这次把错误信息全部打出来了,java.sql.SQLException: 无法从套接字读取更多的数据,是使用mycat连接oracle的,如下所示:

ORA-17410: No more data to read from socket 

Your database connection has timed out, either due to network problems or due to Oracle reaching the IDLE_TIME profile limit. 

Your application however tried to use the connection, but as the connection has closed, failed to do so. 
This error mostly happens when using connection pools. Normally, when a connection is timed out or gone, the application should automatically reconnect. 
Failure to do so results in this error.

经查,oracle后台以及alert.log没有任何异常,也不应该是oracle jdbc驱动的问题,trace文件也没有异常。

看了下mycat.log,13:00之后,心跳就没发了,如下:

重启mycat之后,应用没有重启,再次运行,就没有这个问题了(所以原因无非是:1、网络负载太高、超时;2、oracle服务器刚好重启、但是未超过jdbc连接池的空闲重试,于是第一次执行的时候出现该异常;3、驱动层使用有问题。屡试不爽)。之前也是,mycat经常遇到各种奇葩问题,因为我们是两台虚拟机,不排除网络不稳定,但是都没有解决方案。看下用的是dataHost的连接数都很大,应该不是这个问题,只有三个心跳日志是因为配置了三个dataHost。

不过我们已经打算切换sharding-jdbc了。

参考:

https://blog.csdn.net/liduote/article/details/70227040

https://blog.csdn.net/sinat_33517300/article/details/78968181

http://www.iteye.com/problems/38600

https://blog.csdn.net/xiaopeng187/article/details/25797885

原文地址:https://www.cnblogs.com/zhjh256/p/9260018.html