Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (7k points)

My fail over database is showing the following error:

java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208) at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:1131) at oracle.jdbc.OracleConnectionWrapper.commit(OracleConnectionWrapper.java:117)

I have used the same code for other databases as well but I am facing this error only in this database. I have set the AbandonedConnection Timeout to 15 mins and Inactivity Timeout to 30 mins.

 Can someone help me with this?

2 Answers

0 votes
by (13.1k points)

The error means that the connection was successfully established at some point, but when you have tried to commit the change, the connection was no longer open. The parameters you have mentioned above look like connection pool settings. If so, they are not related to this problem. The most likely cause is a firewall between the user and the database that is killing connections after a certain amount of idle time. You can try to fix it by making your connection pool run a validation query when a connection is checked from it. This will immediately identify and remove the dead connections, ensuring that you get only good connections out of the pool.

Want to learn Java? check out the core Java certification from Intellipaat.

0 votes
ago by (1.7k points)

It produces an error message that looks like `java.sql.SQLException: Closed Connection`. Therefore, it is closed before it commits. It may also be related to checking on timeout, automatic reconnecting, verification before the application's connection to it, and a strong network. Implement pooling of connections.

Related questions

0 votes
1 answer
asked Dec 17, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Mar 6, 2021 in Java by Jake (7k points)
0 votes
1 answer
0 votes
4 answers

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...