How do i speed up report generating with jasper reports

0

Am generating reports with the following codes but it takes some time to display:

        try
    {
      Connection con =ConnectDB.getMyConnection();
      String sql="SELECT * FROM rep5";
      Statement st=con.createStatement();
      ResultSet rs=st.executeQuery(sql);
     if(rs.next())
     { 

      JasperDesign jd = JRXmlLoader.load("C:\\CPIMS\\src\\cpims\\report5.jrxml");
        String sql2 = "SELECT Cnt,Nam,Sir,DOD,Gen,Year,Sch,Title FROM rep5";
        JRDesignQuery newquery = new JRDesignQuery();
        newquery.setText(sql2);
        jd.setQuery(newquery);
        JasperReport jss = JasperCompileManager.compileReport(jd);
        JasperPrint jp = JasperFillManager.fillReport(jss, null, con);
        JasperViewer.viewReport(jp, false);

 }else
     {
     JOptionPane.showMessageDialog(null,"No records found in the database","",JOptionPane.INFORMATION_MESSAGE);
     }
    }catch(Exception ex)
    {
    JOptionPane.showMessageDialog(null,ex.getMessage());
    }

jamesmuriithiwanja's picture
Joined: Jan 23 2020 - 11:48pm
Last seen: 1 month 3 days ago

0 Answers:

No answers yet
Feedback
randomness