title: Best way to manage database connection for a Java servlet
body: <p>What is the best way to manage a database connection in a Java servlet?</p>
  
  <p>Currently, I simply open a connection in the <code>init()</code> function, and then close it in <code>destroy()</code>. </p>
  
  <p>However, I am concerned that "permanently" holding onto a database connection could be a bad thing. </p>
  
  <p>Is this the correct way to handle this?  If not, what are some better options?</p>
  
  <p>edit: to give a bit more clarification: I have tried simply opening/closing a new connection for each request, but with testing I've seen performance issues due to creating too many connections.</p>
  
  <p>Is there any value in sharing a connection over multiple requests?   The requests for this application are almost all "read-only" and come fairly rapidly (although the data requested is fairly small).</p>