This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes ResultSet.close() Vs Connection.close() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ResultSet.close() Vs Connection.close()" Watch "ResultSet.close() Vs Connection.close()" New topic
Author

ResultSet.close() Vs Connection.close()

Zein Nunna
Ranch Hand

Joined: Mar 31, 2005
Posts: 245
Hi guys

Does anybody know what the difference between these to methods is?

ResultSet.close() and Connection.close() ??

I use them interchangebbly, would this have an adverse effect on my app in anayway??

Thanks in advance for your thoughts,

Regards
Zein
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
In a properly written JDBC driver, Connection.close() will close any open Statement or ResultSet objects that were opened on that Connection, before closing the connection itself. ResultSet.close() will merely close the ResultSet, leaving open any Statement or Connection above it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: ResultSet.close() Vs Connection.close()