Win a copy of Spring Boot in Practice this week in the Spring forum!

singh Mari

Greenhorn
+ Follow
since Mar 25, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by singh Mari

i am using jasper viewer in web application. i want shown jasper viewer in client side. i got one idea from websites . that is this used by applet.but i does not used this. please help me for this.
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
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()
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"
Hello,
How to call jasper subreport in java
13 years ago
JSF
i am using jasper report and subreport for print purposes. when subreport are using the following error messages came.

" The supplied java.sql.connectionobject is null"
13 years ago
JSF