I am getting a little confused, I was reading the below from http://en.wikipedia.org/wiki/Java_Database_Connectivity
Connection conn = DriverManager.getConn
It is enough to close just Statement
and Connection
. There is no need to explicitly close the ResultSet
object.
Java documentation says about java.sql.ResultSet
:
A ResultSet object is automatically closed by the Statement object that generated it when that Statement object is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results.
Thanks BalusC for comments: "I wouldn't rely on that. Some JDBC drivers fail on that."