Why not do a query specifically for the records you are interested in?
In other words "select * from table where field_name = 'Vishal'" rather than "select * from table". This will cut down on the amount of work the database has to do. And if you aren't using the data, there is no reason to return it to the Java layer.
Thanks for your reply. The reason I am doing it is I have a database containing records of say, 1000 agents. Every month I recieve a new file containing updated counts for the agent. In this case I have to check if I have the agent already in my database or not. If the record does not exist, then I have to insert a record with the new values, else I have to update the existing record by adding the new values to the existing value. If there is no way of filtering a recordset of 1000 agents, then I will have to execute the select and update or insert query for each agent 1000 times:(. And also, this agent count could increase to 10000 in future!
I was thinking that I could create a recordset with all the existing records and then use the Resultset.updateRow() or Resultset.insertRow() method to update or insert which ever row I want. But the only problem is how do I get to that specific record without looping through the resultset.
Assuming that your driver supports updatable ResultSets - have you checked? - it is possible that each row update will require a round-trip to the database. If so, then an updatable ResultSet may not suitable for updating thousands of rows.