0
votes

I'm using iReport 5.7.0
My task is to generate a report with multiple datasources : XML datasource and a Database . So I created a subreport that use a database connection .
I did the following steps :
1) define an XML datasource
2) create a report that use this datasource
3) create a parameter named "connection" with defaultesxpression :

     java.sql.DriverManager.getConnection("jdbc:oracle:thin:@192.168.10.239:1521:DBNAME", "DBUSER", "DBPW")

parameter class : java.sql.Connection

3) create a subreport with the connection expression : $P{connection} But I got the following error

Error filling print... Error evaluating expression :      Source text : java.sql.DriverManager.getConnection("jdbc:oracle:thin:@192.168.10.239:1521:DBNAME", "DBUSER", "DBPW") net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :      Source text : java.sql.DriverManager.getConnection("jdbc:oracle:thin:@192.168.10.239:1521:DBNAME", "DBUSER", "DBPW")    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:263)      at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:611)      at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:579)      at net.sf.jasperreports.engine.fill.JRFillDataset.setFillParameterValues(JRFillDataset.java:996)      at net.sf.jasperreports.engine.fill.JRFillDataset.setParameterValues(JRFillDataset.java:637)      at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1313)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:931)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:873)      at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:87)      at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:287)      at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:760)      at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:891)      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)      at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)  Caused by: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@192.168.10.239:1521:DBNAME      at java.sql.DriverManager.getConnection(DriverManager.java:596)      at java.sql.DriverManager.getConnection(DriverManager.java:215)      at report4_1407933336571_300812.evaluate(report4_1407933336571_300812:236)      at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:250)      ... 13 more  Print not filled. Try to use an EmptyDataSource...

Any help please ??

1

1 Answers

0
votes

I use iReport-5.1.0. Copy your sql connector, ex: mysql-connector-java-5.0.4-bin.jar to

C:\Program Files (x86)\Jaspersoft\iReport-5.1.0\platform9\lib

and restart your iReport, run your report again.