File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to create two simple jasper subreport and integrated to master report

 
singh Mari
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir,
Thank you for your reply.now i correct null connection error. The following code used"

master.jrxml
<connectionExpression><![CDATA[java.sql.DriverManager.getConnection("jdbc:mysql://localhost:3306/sims1", "root", "pwd")]]></connectionExpression>

But i run the program only master report can occur not subreport.
The exact code i used:

Print.java
//Map parameters = new HashMap();
//parameters.put("SUBREPORT_DIR",subreport);
HashMap<String, String> parameters = new HashMap<String, String>();
Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/sims1", "root", "pwd");
//Statement stmt = (Statement) con.createStatement();
//ResultSet rs = stmt.executeQuery("SELECT * FROM consolidateprint");
//JRResultSetDataSource dataSource = new JRResultSetDataSource(rs);
JasperReport jasperReport = JasperCompileManager.compileReport("C://SIMS/web/error1.jrxml");
// JasperReport jasperReport1 = JasperCompileManager.compileReport("C://SIMS/web/suberror1.jrxml");
JasperPrint jprint = JasperFillManager.fillReport(jasperReport, parameters,con);
JasperViewer jasViewer = new JasperViewer(jprint, false);
jasViewer.setVisible(true);
jasViewer.toFront();

so i want how to pass the parameter, connection to jasper subreport

Please sir help me for this problem.


Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic