ResultSet closed error!
hi,
I'm using normal jdbc:odbc driver for oracle and when i'm running the jsp page few times,
i'm getting the error "ResultSet closed", only 50 processes.
I've opened the initorcl.ora file and the no. of processes is set to 50,
So it is firing that error, but in every page in the method jspdestroy(), i'm using the conn.close() statement,
is that not sufficient to close the connection, when do the jspdestroy() fires,
if i'm closing the connection then i should'nt get the error then,
Can anyone suggest me how to tackle the database connections,
I'm using in every page database connections, and in every jspdestroy() method i'm closing
the connections.
What might be the problem.
[774 byte] By [
hikiran] at [2007-9-26 3:19:46]

Setup a connection pool, we you need get sth. from database, get a connection, do SQL query, after fetch rows, put the connection back to the pool. The you cannot do con.close() at jspdestroy, because you cannot expect when the jspdestroy called.
Setup a connection pool, we you need get sth. from database, get a connection, do SQL query, after fetch rows, put the connection back to the pool. The you cannot do con.close() at jspdestroy, because you cannot expect when the jspdestroy called.
Hi,
The problem is you are using a servlet. In the theory it is not always explained very clearly, but a servlet is instantiated once by a webserver (on the first invocation), and the instance is being kept in memory. So no overhead is needed to perform initialization every time.
But this means the destroy method is only performed when the application is unloaded from the application server. So if the application is re-loaded, the server is stopped or re-started. Then the destroy method is called.
So you'd better create a connection in the init, which you keep in a local varaible for re-use, and you free at the destroy of the JSP, or you close the connection at the end of the JSP page. (or better, build a finally statement in the service() method of the JSP).
regards,
Jeroen.
jewes at 2007-6-29 11:35:04 >
