Results 1 to 6 of 6
Thread: Exception : ResultSet is closed
- 04-08-2008, 01:26 PM #1
Member
- Join Date
- Apr 2008
- Posts
- 5
- Rep Power
- 0
Exception : ResultSet is closed
Hi folks
I have a problem while closing the ResultSet in JDBC.
iam using Postgre DB, here for normal execution it is working fine,
but while we are doing load test at the rate of 30 or 40 hits to the
application on a peak volume it is throwing the error like
"PSQLException:This ResultSet is closed."
can you please let me know what are all the possibilities....
here is my DB releasing code..
if (pConnection != null) {
pConnection.close();
pConnection = null;
if (pStatement != null) {
pStatement.close();
pStatement = null;
if(pResultSet != null) {
pResultSet.close();
pResultSet = null;
All these statements are enclosed in try/catch block...
I really appreciate for any thoughts...
--Naresh
- 04-22-2008, 02:33 AM #2
Member
- Join Date
- Apr 2008
- Posts
- 28
- Rep Power
- 0
why are you checking to see if it is null? just close it in a finally clause.
your setting it to null after you close it.
- 05-21-2008, 04:39 PM #3
Member
- Join Date
- Dec 2007
- Location
- Mumbai, India
- Posts
- 37
- Rep Power
- 0
hi,
You have to close the objects in the certain order
1. ResultSet
2. PreparedStatement
3. Connection
Regards
Felix T
- 05-22-2008, 05:32 AM #4
What line of code throws the exception? Does it happen when you try to use the ResultSet after a query? Can you show the actual code that uses the ResultSet and indicate the problem line?
Daniel @ [www.littletutorials.com]
Language is froth on the surface of thought
- 08-06-2009, 01:36 PM #5
Member
- Join Date
- Aug 2009
- Posts
- 1
- Rep Power
- 0
ResultSet is never null
Just to add never check
ResultSet rs;
.
.
.
.
(rs != null)
as the resultset is never null
- 08-06-2009, 03:11 PM #6
Similar Threads
-
ResultSet size
By bugger in forum JDBCReplies: 18Last Post: 06-25-2011, 08:36 PM -
Trouble with factory method - unhandled exception type Exception
By desmond5 in forum New To JavaReplies: 1Last Post: 03-08-2008, 06:41 PM -
ResultSet to XML
By Java Tip in forum Java TipReplies: 0Last Post: 02-14-2008, 09:50 AM -
Empty ResultSet
By Java Tip in forum Java TipReplies: 0Last Post: 02-09-2008, 08:36 PM -
ResultSet example
By Java Tip in forum Java TipReplies: 0Last Post: 01-20-2008, 08:59 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks