• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to read resultset

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to run a java application on a solaris 8 machine with apache tomcat webserver. Driver is jdbc thin driver type 4 (classes12.zip).
I have a java class that calls a bean(DBControl) for executing a query. This bean has two methods - one for executing normal select queries(getSelestResult) and the other for updating, inserting or deleting rows in the database(getUpdateResult).
Each of these methods in turn calls another bean(DBProcess) with 4 methods - getConnection() for making a connection to the database, doSelect() for executing a normal select query and returning the resultset, doUpdate() for updating, inserting or deleting rows from database and disconnect() for closing the connection to the database.
The doSelect() method is called by the getSelectResult() of DBControl bean only and doUpdate() is called by the getUpdateResult() of DBControl bean only.
The methods for connecting to the database, querying to the database and returning the resultset are called successively in the try block of the two methods in DBControl bean and the disconnect() method is called in the finally block.
On trying to access the returned resultset from the java class, the following error is displayed.
"java.sql.SQLException: Closed Connection: next"
What could be the possible problem? Is it related to closing the connection in the finally block of DBControl bean before the returned resultset could be used?
These beans have worked satisfactorily on linux with apache tomcat webserver and postgresql as the database.
Thanks,
Shailesh.
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This would best be answered in the JDBC forum. I'm moving it there.
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The connection is most likely closed when the resultset goes out of scope... either by a finally block of the class or explicitly by your code. Can you return a CachedRowSet or ArrayList instead?
Jamie
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic