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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

java.sql.SQLException: Closed Connection: next

Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE
at oracle.jdbc.dbaccess.DBError.check_error(DBError.j ava:1130)
at com.syntegra.nasp.etpadmin.db.DBAccessor.selectRec ords(
at com.syntegra.nasp.etpadmin.extract.MainClass.extra ctRecords(
at com.syntegra.nasp.etpadmin.service.ETPAdminBean.ex tractRecords(
at sun.reflect.GeneratedMethodAccessor68.invoke(Unkno wn Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
at java.lang.reflect.Method.invoke(
at com.sun.ejb.containers.EJBLocalObjectInvocationHan dler.invoke( 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