Java.sql.SQLException: Io exception: damaged channel, how to recover without rebooting?

In my application, I use a connection to Oracle, when the connection is lost, and I try to connect to it, I get an exception:

java.sql.SQLException: Io exception: Broken pipe at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:161) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:273) at oracle.jdbc.driver.T4CStatement.fetch(T4CStatement.java:540) at oracle.jdbc.driver.OracleResultSetImpl.close_or_fetch_from_next(OracleResultSetImpl.java:264) at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:196) 

To restore, I need to restart the application, is it possible to restore without rebooting? Thanks.

+6
source share
1 answer

Approaches might be features that might throw an exception:

  • Network Problem: This is the network between the database and the application server that causes the physical connection to be deleted after some time. This is probably due to the fact that the firewall is working behind a network that is configured to kill db connections after a certain period of time. You might think of a workaround to keep the connection alive all the time just by reconfiguring the application server. For Tomcat, you can try adding validationQuery="select 'validationQuery' from dua l to the conf file for the datcatource Tomcat file (context.xml)

  • Connections to the database server are reset, and the client is not notified by the database driver. The problem in this case is that the Oracle driver detects that its socket for the DBMS is somehow (again, maybe the firewall?) Was closed by the other end. You might consider setting the connection timeout (in the pool) to be shorter than the network / database server timeout as a solution.

+3
source

Source: https://habr.com/ru/post/911067/


All Articles