Ajay Singh Rathore
Ajay Singh Rathore

Reputation: 11

java.sql.SQLException: Closed Connection java JDBC

I am getting the Error in Production as per below. Can any one give some input to eliminate this error.

java.sql.SQLException: Closed Connection
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:113)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:147)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:209)
    at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:3550)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3396)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3460)
    at com.IBS.trade.order.netPortfolio.getClientPortfolioDetails(netPortfolio.java:556)
    at core.ClientThreadInteractive.getNetPortFolioData(ClientThreadInteractive.java:14403)
    at core.ClientThreadInteractive.netPortfolioSingle(ClientThreadInteractive.java:14370)
    at core.ClientThreadInteractive.run(ClientThreadInteractive.java:1895)

Upvotes: 1

Views: 25595

Answers (3)

sunil karki
sunil karki

Reputation: 407

Simply restarting the Application worked for me. This error is due to unavailability of resources or unable to connect to DB for some reason in JDBC.

Upvotes: 0

Ankit Katiyar
Ankit Katiyar

Reputation: 3001

Track shows that your connection has been closed when you are trying to use. There are few possibilities depending on your connection management.

1- Your invoked close().

2- You exceed the maximum idle timeout so database has closed your connection.

Basically it depends how you manage your connections if using per thread then may be possible that somewhere it closed during your thread that wasn't working.

-- Some details about your connection management can explain it better

Upvotes: 3

Ninad Pingale
Ninad Pingale

Reputation: 7069

Somewhere you are closing connection.

con.close();

And after that trying to access the database.

Upvotes: 2

Related Questions