java. sql. Sqlexception: IO exception: how to recover the damaged pipeline without restarting?
In my application, I use to connect to Oracle. When the connection is lost and I try to reconnect, I receive 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)
For recovery, I need to restart the application. Can I recover without restarting? thank you.
Solution
The following may be the possibilities leading to exceptions:
>Network problem: This is the network between the database and the application server, resulting in the physical connection being discarded after a period of time This may be because the firewall running behind the network is configured to terminate the database connection after a specified period of time You can consider a solution to keep the connection active by simply reconfiguring the application server For tomcat, you can try to add validationquery = "select 'validate" > from dual in the Tomcat data source configuration file (context. XML). The connection to the database server is being reset, and the database driver does not notify the client The problem in this case is that the Oracle driver finds that it is in some way to the DBMS socket (firewall, maybe?) Has been closed by the other end You can consider setting the connection timeout (in the pool) to be shorter than the network / database server timeout