Following is my helper class to get DB connection:
I\'ve used the C3P0 connection pooling as described here.
public class DBConnection {
private
The code looks fine to me, but I would write a helper method that does the close operations or you'll get this verbose finally-block in every DAO or method. Maybe you should write three separate try-catch-blocks around the close Operations, to make sure the connection is closed no matter if the statement and resultset have thrown an exection. Also note that the javadoc says
When a Statement object is closed, its current ResultSet object, if one exists, is also closed.
So you don't need to close the resultset in the above example, but you could.
The linked cleanup method is for closing the datasource, what isn't needed in most projects because the DS lives as long as your app is running.