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.
Joined: Jun 13, 2000
This would best be answered in the JDBC forum. I'm moving it there.
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