Reputation: 19
I want to export 200k records from database as a .xlsx file. I am using Apache POI. I am getting broken pipe exception after 20 minutes
file = File.createTempFile("Rule_File", ".xlsx");
FileOutputStream out = new FileOutputStream(file);
long heapSize = Runtime.getRuntime().totalMemory();
long freeSize = Runtime.getRuntime().freeMemory();
long totalSize = Runtime.getRuntime().maxMemory();
System.out.println("Heap Size = " + heapSize);
System.out.println("freeSize = " + freeSize);
System.out.println("totalSize = " + totalSize);
// ZipOutputStream out = new ZipOutputStream(new FileOutputStream(file));
//workbook.write(out);
Upvotes: 1
Views: 207
Reputation: 4506
I guess the socket to the DB makes a timeout after 20 minutes.
Either configure a longer timeout if possible. Or you might be able to run the scripts in smaller chunks that runs in less than 20 minutes and then append the results?
Upvotes: 1