Jump to content
Changes to the Jaspersoft community edition download ×

How do i speed up report generating with jasper reports


jamesmuriithiwanja

Recommended Posts

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());
    }

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...