I am building an application in whcih I want that when I execute a query the selected rows may be 4000 transfering these rows on the network will take mmore time I want that the first I will get the say 50 rows if wanted value is in those 50 rows then i dont need the rest result so I dont want the rest result should travel the network so I can close ResultSet if the required value is not in the first 50 rows then i should be able to call the next 50 rows and this process can be repeated till the end of ResultSet If this can be done please help me Bansal
I should defintiely put this in a FAQ! The ResultSet does not contain any data! If you do a "select * from a" where a is a table with 100,000,000 rows, you do not transfer 100,000,000 rows worth of data to your program! The ResultSet is only a way to transfer data, one row at a time, from the database to your program. When you do a rs.next(), the ResultSet goes out to the database and gets a single row. So don't worry about transferring 4,000 rows from the database to your ResultSet. If the row you wanted was the 63rd row then only 63 rows will travel across the network. Now if you'll excuse me I need to go bang my head against a wall.