jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases and the fly likes java.sql.SQLException: Closed Connection: next Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "java.sql.SQLException: Closed Connection: next" Watch "java.sql.SQLException: Closed Connection: next" New topic

java.sql.SQLException: Closed Connection: next

Ravi Challapalli

Joined: Jun 02, 2009
Posts: 5
I am encoutering the following exception:
java.sql.SQLException: Closed Connection: next

My code calls a Oracle stored procedure which returns a cursor back with the results of some queries. The procedure also does some inserts in to audit tables which are commited by the App Server Transaction container as part of the EJB. The retrieved cursor is processed in the EJB which takes quite some time before the JDBC statement object is closed and the container commits the transaction.

Below is the stack trace of the exception:

java.sql.SQLException: Closed Connection: next
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:179)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.j ava:1130)
at oracle.jdbc.driver.OracleResultSetImpl.next(Oracle ResultSetImpl.java:218)
at com.syntegra.nasp.etpadmin.db.DBAccessor.selectRec ords(DBAccessor.java:142)
at com.syntegra.nasp.etpadmin.extract.MainClass.extra ctRecords(MainClass.java:67)
at com.syntegra.nasp.etpadmin.service.ETPAdminBean.ex tractRecords(ETPAdminBean.java:408)
at sun.reflect.GeneratedMethodAccessor68.invoke(Unkno wn Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.security.SecurityUtil.invoke(Se curityUtil.java:147)
at com.sun.ejb.containers.EJBLocalObjectInvocationHan dler.invoke(EJBLocalObjectInvocationHandler.java:1 28)
at $Proxy9.extractRecords(Unknown Source)
John Kimball
Ranch Hand

Joined: Apr 13, 2009
Posts: 96
Whatever you're doing, by the time you need to fetch more via next() the connection to the server has obviously terminated.

Maybe it timed out or was killed, but there's no way to tell w/ just the exception.

What's the timeout limit of connections (check w/ the administrator)?
Is your process is intensive or involves huge transactions? Maybe it was it killed by an administrator/administrative process?

I agree. Here's the link: http://aspose.com/file-tools
subject: java.sql.SQLException: Closed Connection: next
It's not a secret anymore!