• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

How to call 3 jasper report subreport in java code

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm no Jasper expert, but how are you supplying the connection?
 
singh Mari
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic