title: How to properly clean up JDBC resources in Java?
body: <p>What is considered best practices when cleaning up JDBC resources and why? I kept the example short, thus just the cleaning up of the ResultSet. </p>
  
  <pre><code>finally
  {
    if(rs != null)
      try{ rs.close(); } catch(SQLException ignored) {}
  }
  </code></pre>
  
  <p>versus</p>
  
  <pre><code>finally
  {
    try{ rs.close(); } catch(Exception ignored) {}
  }
  </code></pre>
  
  <p>Personally I favour the second option since it is a bit shorter. Any input on this is much appreciated. </p>