Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

java.sql.SQLException: Closed Connection: next

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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)
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic