This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Large ResultSets causing OutOfMemory error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Large ResultSets causing OutOfMemory error" Watch "Large ResultSets causing OutOfMemory error" New topic
Author

Large ResultSets causing OutOfMemory error

Tim Vries
Greenhorn

Joined: Nov 29, 2001
Posts: 8
I have some particularly large ResultSets (200K+ rows) that I need to manipulate that are causing OutOfMemory errors when I try to run it. I can get around it but using some of the nonstandard command line options to increase the heap size (-Xms and -Xmx) or by using a reference cursor on the database, but that is not the ideal solution to my problem. Is there a way to fetch and process only X records at a time and then discard them from memory after I'm done?
Tim Vries
Greenhorn

Joined: Nov 29, 2001
Posts: 8
Solved my own problem. Stupid mistake. The ResultSet was setup as scrollable so it read the whole ResultSet into memory.
 
 
subject: Large ResultSets causing OutOfMemory error
 
Similar Threads
outOfMemory
OutOfMemory Error
OutOfMemory Error and Statement.close()
OutOfMemory
OutOfMemory