Forums Register Login

java.lang OutOfMemoryError

+Pie Number of slices to send: Send
Hi there,
I'm getting java.lang.OutOfMemoryError everytime I select more than 50,000 records from mysql database. There is no problem if the result set is less than 50,000. I've already tried increasing the tomcat heap size to maximum but it didn't solve the problem. I'm actually selecting the records from the database using servlet and placing it in a java bean. How can I solve this problem.

Thank you,
rupa
+Pie Number of slices to send: Send
Select fewer records in one go. What do you need 50000 at the same time for? Its usually very unlikely that you will be able to display 50000 records on a web page (my assumption, since you mention you are using a servlet), so instead select them smaller chuncks.
+Pie Number of slices to send: Send
Thank you for your suggestion. But the problem is I have to select all those records and output it to one text file. How can I do that? Thank you again.
+Pie Number of slices to send: Send
My recommendation doesn't change. If you are sure it is the data retrieval which is causing your OutOfMemoryException (and at 50000 records it probably is) retrieve them in smaller chunks and append them to your file.
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 512 times.
Similar Threads
Problem facing with executebatch function
Problem with DataBase or Server
Design Pattern for Pagination in J2EE Application
Problem with DataBase or Server
Handling large amount of data in tomcat memory
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:40:38.