Hi, Iam developing an application where in I need to read the data from a Table and I had to populate it in the Excel sheet. In a single stretch Iam fetching some where around 60,000 records from the table. The ResultSet is holding that much of data and then Iam writing the result set in to a File.
Is it the right way to handle the data or is there any optimal way to do this....
A ResultSet is allowed to be lazy. (I once read that they are all lazy when they can be, but can't confirm that myself.) That is, it can pull some subset of rows from the database into its own memory. When you use next() enough times to get to the end of that chunk, it gets more. That means it doesn't have to hold the entire result in memory at one time, designed just for situations like yours.
If you don't hold it all in memory either you may well come out ok. Sounds like you're writing to a file and not filling a collection with data. Have you tried it on large results and run into trouble? Or are you more concerned about scaling up in the future?
You can defeat this lazy scheme by specifying a bi-directional cursor. Make sure your default cursor is forward reading only.
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
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com