0

We are getting the exception of java.sql.SQLRecoverableException: No more data to read from socket in our application, which is making the connection corrupted. After this, we are not able to fetch any connection from the connection pool and it is displaying the error as Connection closed. Now we are mitigating this issue by restarting the server. We found the root cause of this issue in one area of our application, we are calling a procedure which is calling an external db link and if that external db is down, we get this 'java.sql.SQLRecoverableException: No more data to read from socket` which is an expected behavior.

Here my problem is: As this procedure is calling from only a part of the application, it is affecting the whole connections in the connection pool. Is there a way to handle this exception in that specific part (where this exception is thrown) so that this should not affect the connection pool?

Note: Code for closing the connection is properly implemented in the code.

6
  • Start using some sort of connection pool manager. It will recreate dead connections. Commented Jul 26, 2017 at 7:42
  • I am using connection pool and the server is tomcat 8. Is there any thing called connection pool manager. I checked it and but I am not able to find anything on that. Commented Jul 26, 2017 at 8:37
  • If you are using managed connection pool, and you are not able to get new connections after some application db operation failures than obviously you got misconfigured connection pool, as it shoud detech and remove faulty connections with new, valid ones. Here is an example mchange.com/projects/c3p0 Commented Jul 26, 2017 at 8:50
  • Thanks Antoniosss, we are not facing issues for other db operation failures, except for this one. Full exception String is "java.sql.SQLRecoverableException: No more data to read from socket" and I can see in the below link that we have to either reset the connection pool or restart the server. Currently we are planning to use 'testOnBorrow' and as per the specfication it will validate all the connections borrowing from the pool. But in our application, this happens only in that area. Commented Jul 26, 2017 at 9:16
  • stackoverflow.com/questions/27898780/… Commented Jul 26, 2017 at 9:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.