title: Should I catch exceptions thrown when closing java.sql.Connection
body: <p><code>Connection.close()</code> may throw <code>SqlException</code>, but I have always assumed that it is safe to ignore any such exceptions (and I have never seen code that does not ignore them). </p>
  
  <p>Normally I would write:</p>
  
  <pre><code> try{
      connection.close();
   }catch(Exception e) {}
  </code></pre>
  
  <p>Or </p>
  
  <pre><code> try{
      connection.close();
   }catch(Exception e) {
       logger.log(e.getMessage(), e); 
   }
  </code></pre>
  
  <p>The question is:</p>
  
  <ol>
  <li>Is it bad practice (and has anyone had problems when ignoring such exceptions).</li>
  <li>When <code>Connection.close()</code> does throw any exception.  </li>
  <li>If it is bad how should I handle the exception. </li>
  </ol>
  
  <p>Comment: </p>
  
  <p>I know that discarding exceptions is evil, but I'm reffering only to exceptions thrown when closing a connection (and as I've seen this is fairly common in this case). </p>
  
  <p>Does anyone know when <code>Connection.close()</code> may throw anything? </p>