Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResultSet.close() Vs Connection.close()

 
Zein Nunna
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic