title: Is a finally block the correct location to close a database connection?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1531073/is-java-sql-connection-thread-safe">Is java.sql.Connection thread safe?</a>  </p>
  </blockquote>
  
  
  
  <p>I have gone through some tutorials.<br>
  They said to close the database connection through finally block.<br>
  But I have a question on my mind:  </p>
  
  <blockquote>
    <p>Think about a scenario where two threads are actively reading on one
    connection and one thread finishes his work and closes the
    connection. So what happens to the other?</p>
  </blockquote>
  
  <p>Is the second thread able to complete his task?</p>
  
  <p>Please let me know if my question is not valid and please let me know the best solution.</p>