Kartikbhai! Yes, if you want to do rs.getXXXX() you need connection to be open. Connection is basically a bridge between your Java Code and Database, and Resultset it just a vehicle running on a bridge. If you want to get any goods (read value) using vehicle (read Resultset) you need a bring (read connection) that connect one end to another end(read Java Code to Database).
The normal result set can be lazy about retrieving rows from the db server. If you do a query that returns a million rows the result set might hold only a 1000 until you do next() to row 1001. This makes things easier on the network between the db and the java container and on Java memory. I suppose it makes more work for the database holding data longer until Java asks for it.
You can break this by going to the last row immediately or by using certain cursors. Somebody more conversant with the details may chime in with more ways.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
subject: why getXXX methods of Resultset require connection open?