Hi, I am reading from a muliplte resultset in nested loops and writing to a file. This is a new XML file that i am creating using FileOutputStream and then writing to it. I can write upto 16MB of data and beyond that it gives me an OutOFMemory Error. The sample write statement is as follows fos.write(("<ITDW>" + mainRS.getString(5) + "</ITDW>").getBytes()); I would appreciate suggestion to write a file upto 100MB which is my requirement. Thank You
How much memeory does your system has? This is really strange, cause the stream doesn't keep the entire file, it writes eveything in its buffer and discard them. Can you post more than just that lines of code? Also, what are the size your resultset?
System Memory - 128MB Three ResultSets- Second and Third have Child records of First RS At failure records in teh resultset were First RS - 4000 Second RS - 8000 Third RS - 70000 Max file size so far created - 16MB
Ummm... is your result for column 5 really, really long? Try breaking this up to see exactly which operation is throwing the error:
While we're at it, wrap the FileOutputStream in a Writer so you don't have to create these extra objects. If str is really huge, then msg and bytes are also huge - there's no need for the second two to ever be created if you're careful:
Of course, replace UTF-8 with whatever encoding you wish to use for this file - or omit encoding to use system default. (Whihch varies from machine to machine, so beware sharing files unless you know what encoding is to be used.) If the str string is not really big, then these changes may not make much difference, and your problem is somewhere else. But it's worth checking... [ October 10, 2003: Message edited by: Jim Yingst ]