aspose file tools*
The moose likes Other Open Source Projects and the fly likes How to call 3 jasper report subreport in java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "How to call 3 jasper report subreport in java code" Watch "How to call 3 jasper report subreport in java code" New topic
Author

How to call 3 jasper report subreport in java code

singh Mari
Greenhorn

Joined: Mar 25, 2009
Posts: 6
i am using jasper report and 3-subreports. but i cannot call subreport in java code and the following error can occur,


"The supplied java.sql.connection object is null"
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I'm no Jasper expert, but how are you supplying the connection?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
singh Mari
Greenhorn

Joined: Mar 25, 2009
Posts: 6
Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/sims1", "root", "opel");
Statement stmt = (Statement) con.createStatement();
//ResultSet rs=stmt.executeQuery("select student_id ,student_name,student_date_of_birth FROM student where student_coursename='"+program_name+"'and student_scheme='"+scheme+"'and student_term='"+term+"'");
ResultSet rs = stmt.executeQuery("select * from studentterm where attempt='1'");
JRResultSetDataSource dataSource = new JRResultSetDataSource(rs);
JasperReport jasperReport = JasperCompileManager.compileReport("C://SIMS/web/studentterm1.jrxml");
JasperPrint jprint = JasperFillManager.fillReport(jasperReport, new HashMap(), dataSource);
JasperViewer jasViewer = new JasperViewer(jprint, false);
jasViewer.setVisible(true);
jasViewer.toFront()
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Which line is throwing the exception? Do you have a full stack trace? Also check the datasource before you pass it to Jasper, is it null in your code for some reason?
me bala
Greenhorn

Joined: Oct 07, 2009
Posts: 2
Hi Singh marrie,
Even i want to run the jasper report with the sub report using java files.
If you know that means please share your knowledge.......

I need that..

Thanks in advance...
mebala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to call 3 jasper report subreport in java code
 
Similar Threads
problem in jasper report and subreport
Problem in call jasper subreport in java
[Java & Jasper Report] Simple and very detailed question about subreport "null" field
JasperReport sureport inside subreport
How to fill jasper report using csv file ?