reason for java.sql.SQLException: Closed Connection
Steve Jiang
Ranch Hand
Joined: May 17, 2004
Posts: 106
posted
0
I have the following code , which works fine normally. We found a exception for "java.sql.SQLException: Closed Connection" in a demo site recently. I don't understand why connection is closed , and what could be the reason.
In demo site, it happens everytime, so it looks like not other thread to close the connection.
Could anyone point me the possible reason for "java.sql.SQLException: Closed Connection" in this case?
2010-09-07 06:44:37,411logp.251 - java.sql.SQLException: Closed Connection
java.sql.SQLException: Closed Connection
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445)
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3127)
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3042)
at sysman.util.jdbc.ConnectionWrapper.prepareStatement(ConnectionWrapper.java:577)
at sysman.emo.util.ValueResolver.getCpuCores(ValueResolver.java:805)
Sandeep Sanaboyina
Ranch Hand
Joined: Dec 14, 2009
Posts: 72
posted
0
You are getting a Closed Connection exception because by line 805, your connection object m_conn is getting closed.
It won't be possible to tell why it is getting closed with the code you have provided.
Instead of using
useThat should stop the application from throwing the exception. But, to find out why the connection is closed, you will have to dig in some more ito your code.
They say you have to be the first, the best or different. I say, is it too much to ask for all three.
Steve Jiang
Ranch Hand
Joined: May 17, 2004
Posts: 106
posted
0
Thanks for the reply. Since the demo site is using shiphome, we can't add the debugger for it. But in development env, we haven't met this case before. That make me very curious how the connection could be closed .