This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Statement.close() will close the underlying ResultSet - Is this a guranteed behaviour ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Statement.close() will close the underlying ResultSet - Is this a guranteed behaviour ?" Watch "Statement.close() will close the underlying ResultSet - Is this a guranteed behaviour ?" New topic
Author

Statement.close() will close the underlying ResultSet - Is this a guranteed behaviour ?

Prabhat Jha
Ranch Hand

Joined: Aug 13, 2007
Posts: 58
Hi,

Statement close method will close the underlying ResultSet object. I wanted to check if this is a guranteed behaviour ?


Thanks,
Prabhat
SCJP 1.5, SCWCD 1.5, SCBCD 1.5
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
Note: A Statement object is automatically closed when it is garbage collected. When a Statement object is closed, its current ResultSet object, if one exists, is also closed.

It says so.

Regards,

Fatih.
PrasannaKumar Sathiyanantham
Ranch Hand

Joined: Nov 12, 2009
Posts: 110
yes it is a guaranteed behavior


To err is human,
To forgive is not company policy
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

No it is the recommended behaviour according to the JDBC specification ie documented rather than actual behaviour.
People have gotten it wrong before, it is safer to lose the ResultSet explicitly (in my opinion)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Statement.close() will close the underlying ResultSet - Is this a guranteed behaviour ?
 
Similar Threads
consuquences of not closing ResultSet?
too many open cursors
Pause
Interfaces
Result Sets and Closing Connections