I am using a class DBConnection which has a static method createConnection.I create a connection object like
Connection con=DBConnection.createConnection();
I don't forget to close it along with statements and resultsets.
Now how different is it having the same DBConnection having a normal method createConnection and create a new Connection object like
DBConnection dbConnection=new DBConnection();
Connection con=dBConnection.createConnection();
and ofcourse I don't forget to close the connections,resultset and statement.
Another doubt is does closing a connection mean making it eligible for garbage collection ie. the con variable will now be equal to null?