Sometimes, you encounter the OutOfMemoryException because JasperReports tries to fill data which are bigger than memory allocated to JVM.
Don't be panic. JasperReports can split a big report to smaller segments and store these segment in a temporary directory in your drive.
What you have to do is to set the built-in parameter REPORT_VIRTUALIZER
Take a look at the code below://Create connection to database server
connection = ConnectionPool.getConnection();
//Create a cache at C:\Temp
JRFileVirtualizer fileVirtualizer = new JRFileVirtualizer(3, "c:\\Temp");
//Set parameter REPORT_VIRTUALIZER
HashMap parameterMap = new HashMap();
parameterMap.put(JRParameter.REPORT_VIRTUALIZER, fileVirtualizer);
//Fill data as usual
JasperFillManager.fillReportToFile("MyReport.jasper", parameterMap,connection);
Good luck !
December 02, 2006
OutOfMemory - How to avoid it ?
Tags:
JasperReports
Subscribe to:
Post Comments (Atom)
0 responses:
Post a Comment