Groovy and jdbc connection in a report

Hi

I try to use groovy for my report to connect a subdataset to an Oracle database.

-> In report > properties> language : i selected groovy

-> in my dataset i choose "use an other connection" with the expression :

Sql.newInstance(
                    "jdbc:oracle:thin:@ip:1521:XE",
                    "user",
                    "pw",
                    "oracle.jdbc.driver.OracleDriver"
                )

When i preview the report i get this following error :

net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
    Source text : Sql.newInstance(
 
                    "jdbc:oracle:thin:@ip:1521:XE",
 
                    "user",
 
                    "pw",
 
                    "oracle.jdbc.driver.OracleDriver"
 
                )
 
    at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:466)
 
    at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$18(ReportControler.java:441)
 
    at com.jaspersoft.studio.editor.preview.view.control.ReportControler$4.run(ReportControler.java:333)
 
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
 
Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
    Source text : Sql.newInstance(
 
                    "jdbc:oracle:thin:@ip:1521:XE",
 
                    "user",
 
                    "pw",
 
                    "oracle.jdbc.driver.OracleDriver"
 
                )
 
    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.JRFillElement.evaluateExpression(JRFillElement.java:1016)
 
    at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:392)
 
    at net.sf.jasperreports.components.table.fill.FillTableSubreport.evaluateSubreport(FillTableSubreport.java:92)
 
    at net.sf.jasperreports.components.table.fill.FillTable.evaluate(FillTable.java:118)
 
    at net.sf.jasperreports.engine.fill.JRFillComponentElement.evaluate(JRFillComponentElement.java:110)
 
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:259)
 
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:456)
 
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2067)
 
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:788)
 
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:298)
 
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:152)
 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:963)
 
    at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFiller.run(BaseFillHandle.java:120)
 
    at java.lang.Thread.run(Unknown Source)
 
Caused by: groovy.lang.MissingPropertyException: No such property: Sql for class: reportFacturation_1406640568882_851084
 
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
 
    at org.codehaus.groovy.runtime.callsite.GetEffectivePogoPropertySite.getProperty(GetEffectivePogoPropertySite.java:86)
 
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
 
    at reportFacturation_1406640568882_851084.evaluate(calculator_reportFacturation_1406640568882_851084:263)
 
    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:250)
 
    ... 16 more

Can someone helps me to solve this problem ? Thanks.

PS :

I use jaspersoft studio 5.6

version of groovy : 2.3.6

JDK : 1.7

Pollux Us's picture
Joined: Jun 12 2014 - 2:31am
Last seen: 7 years 11 months ago

0 Answers:

No answers yet
Feedback
randomness