Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

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

 
Greenhorn
Posts: 6
  • 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
 
All of the following truths are shameless lies. But what about this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!