title: Must JDBC Resultsets and Statements be closed separately although the Connection is closed afterwards?
body: <p>It is said to be a good habit to close all JDBC resources after usage. But if I have the following code, is it necessary to close the Resultset and the Statement?</p>
  
  <pre><code>Connection conn = null;
  PreparedStatement stmt = null;
  ResultSet rs = null;
  try {
      conn = // Retrieve connection
      stmt = conn.prepareStatement(// Some SQL);
      rs = stmt.executeQuery();
  } catch(Exception e) {
      // Error Handling
  } finally {
      try { if (rs != null) rs.close(); } catch (Exception e) {};
      try { if (stmt != null) stmt.close(); } catch (Exception e) {};
      try { if (conn != null) conn.close(); } catch (Exception e) {};
  }
  </code></pre>
  
  <p>The question is if the closing of the connection does the job or if it leaves some resources in use.</p>