Salve,
per creare i report utilizzo il seguente codice java:
i problemi sono due :codice:public static void runReport(String databaseName, String userName, String password,String reportFile,String empID) { try{ String report = reportFile; HashMap reportParam = new HashMap(); reportParam.put("EMPID", empID); Connection jdbcConnection = connectDB(databaseName, userName, password); JasperPrint jasperPrint2 = JasperFillManager.fillReport(report, reportParam, jdbcConnection); int lar = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth(); int alt = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight(); JRViewer jrv = new JRViewer(jasperPrint2); jrv.setPreferredSize(new Dimension(lar - 50, alt - 50)); JScrollPane reportScroll = new JScrollPane(jrv); JPanel viewer = new JPanel(); viewer.add(reportScroll); JFrame finestra = new JFrame(); finestra.add(viewer); finestra.pack(); finestra.setVisible(true); finestra.repaint(); }catch(Exception ex) { String connectMsg = "Could not create the report " + ex.getMessage() + "\n " + ex.toString()+"\n"+ex.getCause()+"\n"+ex.fillInStackTrace(); System.out.println(connectMsg); } } public static void main(String[] args) { String databaseName = "xxx" ; String userName = "xxx"; String password = "xxx"; String reportFile = "classic.jasper"; String str=""; /* inserisco gli id da stampare dato che su classic.jasper l'interrogazione sql è del tipo : select * from tabella where id in (str) */ runReport(databaseName, userName, password, reportFile,str); return; }
1) tempi lunghi , per caricare 24k record impiega ben 1 minuto e 6 secondi
2)java heap space, non carica 30k record in quanto esaurisce la memoria
come posso risolvere questi due problemi? c'è un modo + veloce per eseguire il caricamento e la visualizzazione dei dati?



Rispondi quotando