aspose file tools*
The moose likes JDBC and the fly likes Connection Release..... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection Release....." Watch "Connection Release....." New topic
Author

Connection Release.....

C Balajee
Greenhorn

Joined: Oct 18, 2000
Posts: 25
Hi,
I have this following query ...
I have a Connection wrapper class which when instantiated gets a connection from a datasource and stores it into a class level variable.
Throughout the lenghth of my transaction i use this connection to execute my database queries.
I have also written a wrapper for the "Resultset" Generated from execution of a query. This class takes "java.sql.ResultSet" object in its constructor and stores it into a "class level variable" and thyen retreives data from the resultset to populate an hash table.
Now the problem is
As my transaction is completed i close the connection in my connection wrapper class by and explicit call to the "close()" method of the connection object.
But the resultset wrapper that i created early still resides in the memory and so does the "class level reference" to the resultset object.
Now i want to ask
If by closing the connection do i effectively close the resultset object too?(Eventhough there are references still in the memory to it)
If so then the connection now needs to be released?
But if i look at my database server i see that no connection is released..... And this leads to a shortage of connections and no further connections are available to me.(Eventhough no work is currently going on.).
Does the references to the resultset object create these problems???
looking for ward to any help and suggestions
regards
C Balajee
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Yes, closing the connection closes the resultset and statement objects, since they both depend on the connection.
------------------
Bosun
SCJP for the Java� 2 Platform


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
C Balajee
Greenhorn

Joined: Oct 18, 2000
Posts: 25
You can try the following code in other JSP's or servlets..
session.getAttribute("email");
this will return an object which you need to cast to your connection pool.
the variable "session" is readily available with JSP Pages..
But in servlet you need to call
requestObject.getSession(true/false)
Hope this helps...
regards
C Balajee
C Balajee
Greenhorn

Joined: Oct 18, 2000
Posts: 25
Hi Bosun,
I also aggree that closing the conection will in turn close the statement and the resultset.
By "closing" you must mean that that the particular statement/resultset is not available for further use..
My query is what will happen if a reference to the closed resultset still exists in the memory..??
Will the connection pool manager of WebSphere release the connection for further use??
regards
C Balajee

Note..
Disregard the previous post that was meant for a different thread..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connection Release.....