This is the way for me to get my connection
DataSource ds = (DataSource) ctx.lookup("glassfish_pool_res");
connection = ds.getConnection();
After I use the connection, like this:
CallableStatement cs = connection.prepareCall(call_statement);
...
cs.execute();
should I do cs.close() and connection.close() right after?
Is that the right way to close the connection to avoid memory leaks?
I’m developing a web application btw.
Yes. That is right way to do.