Originally posted by Dennis Lee:
I have to use Java to retrieve one million records in DB2 and write the records into a txt file. I think the ResultSet is unable to hold so many records in memory. We also need to get the better performance. How could I do? Hope to get your help. Thanks a lot.
Not a problem. Your resultset doesn't really hold the million records in memory ( unless you use a scrollable ResultSet == BAD ). I punch through a million records the same way I punch through 10:
The actual number of records held in memory at one time is equal to the FetchSize of the Statement/ResultSet. For processing a large number of records, you may want to increase the fetch size ( reduces the number of DB calls ) until you find that it's not increasing the application speed anymore.
Jamie
Joe, not sure what this had to do with paging?