title: After getting the connection from Glassfish Connection Pool and use it, should I close it right after?
body: <p>This is the way for me to get my connection</p>
  
  <pre><code>DataSource ds = (DataSource) ctx.lookup("glassfish_pool_res");
  connection = ds.getConnection();
  </code></pre>
  
  <p>After I use the connection, like this:</p>
  
  <pre><code>CallableStatement cs = connection.prepareCall(call_statement);
  ...
  cs.execute();
  </code></pre>
  
  <p>should I do <code>cs.close()</code> and <code>connection.close()</code> right after?
  Is that the right way to close the connection to avoid memory leaks?
  I'm developing a web application btw.</p>