I am given a task to convert a huge table to custom XML file. I will be using Java for this job.
If I simply issue a \"SELECT * FROM customer\", it may return huge a
At which stage is the OOM error occurring, is it on data retrieval or processing data to XML file?
If its data retrieval, get the data in batches. Get the total number of rows first, order the selects by the primary key and limit the rows selected to chewable sizes.
If its at creating the XML file, send the XML node of each customer to System.out.println, don't hold it in memory. Launch the program via commad line and redirect all output to a file;
java MyConverter > results.txt
As you loop through the record all is saved in the file.