Jotty, I aggree to Jamie, We should free the database resources as soon as possible. But look how we declare statements amd resultset Statement stmt=connection.createStatement(); ResultSet rs=stmt.getResultSet(); that means statement and resultset are created with the help of connection object. When you are saying "connection.close()" you don't have to explicitly close Statements and ResultSet. The resources will be freed at the same time. If anybody has some other views please let me know.
the connection object will invoke the methods Statement.close() and ResultSet.close() on all associated statements/resultsets when you invoke the method Connection.close(). But why would you not release the DB resources at the earliest possible time? By not doing so, it will make your code more less readable and definitely deplete network/DB performance on higher traffic applications. Some DB's are affected more than others when it comes to increased traffic. Jamie