jkeri Posted June 7, 2018 Share Posted June 7, 2018 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.Connectionand 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 More sharing options...
darth_fader Posted June 16, 2018 Share Posted June 16, 2018 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now