Jump to content

Report with EXCEL and Oracle data source


jkeri

Recommended Posts

I have a report (Jasper 6.3.0) that has an EXCEL sheet as the MAIN report and a subreport from with an oracle data source.

 

In MAIN i created a parameter: subConn and class:  java.sql.Connection

and Default Value Expression: java.sql.DriverManager.getConnection("jdbc:oracle://myhost:1525/mySID", "myuser", "mypassword")

I do not know what to do in the subreport side.

 

Do I also need to declare parameter subConn in the SUBREPORT? and what else is needed in the SUBREPORT.

 

SubConn

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

In parent report, pass that oracle connection parameter to your subreport right below where you would pass sub report parameters, as follows:

<subreportParameter name="orgId">
                    <subreportParameterExpression><![CDATA[$P{orgId}]]></subreportParameterExpression>
 </subreportParameter>
 <subreportParameter name="personId">
                    <subreportParameterExpression><![CDATA[$P{personId}]]></subreportParameterExpression>
 </subreportParameter>                

<connectionExpression><![CDATA[$P{oracleConnectionParam}]]></connectionExpression>


You don't need to do anything else in the subreport itself. Just make sure oracleConnectionParam is defined as type java.sql.Connection in the parent. Connection Expression is available in Jaspersoft Studio GUI as well if you're not sure how to define that for the subreport element

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...