JavaDoc for Statement is clear:
All execution methods in the Statement interface implicitly close a statment’s current
ResultSetobject if an open one exists.When a
Statementobject is closed, its currentResultSetobject, if one exists, is also closed.
However, there are multiple recommendations to close ResultSet before Statement both on Stack Overflow and on the web in general. Are there known cases where (presumably due to buggy drivers) closing Statement but not ResultSet leads to problems?
It’s possible that a buggy JDBC driver could not close ResultSet. Regardless it is best to be specific and intentional so you should close your ResultSet in try…finally block. If you are using JDK7 you can declare the ResultSet variable in the try clause and because it implements AutoCloseable it will be closed automatically without a finally clause.