i developing invoice printing system using jasper report, have can print report take 2000ms load report, 2000ms take start printing, these using jar files,
commons-beanutils-1.4 commons-digester-1.7 commons-logging-1.0.3 commons-beanutils-1.4 groovy-all-1.7.5 batik-all-1.7 barcode4j-2.1 itextpdf-5.1.0 jasperreports-6.0.3 xercesimpl-2.11.0 xml-apis-ext-1.3.04
preparedstatement = conn.preparestatement(sqlstring); resultset = preparedstatement.executequery(); if (resultset.next()) { hashmap<string, object> hm = new hashmap<>(); jasperdesign jasperdesign = jrxmlloader.load(new file( "c:/invoice/invoice.jrxml")); jrdesignquery designquery = new jrdesignquery(); designquery.settext(sqlstring); jasperdesign.setquery(designquery); jasperreport jasperreport = jaspercompilemanager .compilereport(jasperdesign); jasperprint jasperprint = jasperfillmanager.fillreport( jasperreport, null, conn); (int = 0; < copies; i++) { jasperprintmanager.printreport(jasperprint, false); } jasperviewer.viewreport(jasperprint);
the above code used print report but, getting time load report. please suggest fault , other idea...
i guess sql query problem. have tried executing in sql query tool , check how long runs? optimizing should yield performance win.
you running query twice: before report , when filling via jasperfillmanager.fillreport() call.
if there no specific reasons check wheter query contains records, recommand let jasperreports handle query , case no record found. can determine specific behaviour in case via "when no data type" property in reportdesign.
Comments
Post a Comment