marcosmalfatti Posted January 13, 2009 Share Posted January 13, 2009 Hello!I have a problem....I make a report (1) with Oracle Database, I testing this report and it working fine.I make another report (2) with MySQL Database, I testing this report and it working fine.The problem occours when I put report 2 as subreport from report 1. If I use "Same Connection", the report 2 try connect with Oracle, if I use "Not Use Connection or Datasource", the report 2 is blank.Then, i need make a subreport assume another database connection, how I do it. Thanks for all Link to comment Share on other sites More sharing options...
CaptnTony Posted January 14, 2009 Share Posted January 14, 2009 I create a connection parameter in the master report and pass it to the subreport. Has worked when I need to go to various SQL Server databases so I'm guessing it should work for you as well. Link to comment Share on other sites More sharing options...
glen Posted March 27, 2009 Share Posted March 27, 2009 How exactly do you 'create a connection parameter in the master report' ? I mean what does your parameter expression look like? I spent all day looking for an answer for this yesterday and this morning I found an answer on the JasperServer forums: http://jasperforge.org/plugins/espforum/view.php?group_id=112&forumid=102&topicid=41378 The resulting XML should look like this : Code: This puts the connectionExpression in the master report under the subreport section. I tried creating a parameter (using iReport 3.5.0) and putting the expression in there and then using that parameter under the 'Use Connection Expression'. But I ended up with syntax problems so I just put the expression straight into the subreport section. I also note that the post on the JasperServer forum says that this is possibly going to lead to pool resource problem because the connection is not managed by the server. And a request was logged in 2008 to add better capability into the JasperServer but this is not scheduled to happen. Post Edited by Glen Bremner-Stokes at 03/27/09 12:31 Link to comment Share on other sites More sharing options...
glen Posted March 27, 2009 Share Posted March 27, 2009 Here is my final jrxml of the master report if anyone is interested. Link to comment Share on other sites More sharing options...
Hugo Mota Posted August 27, 2019 Share Posted August 27, 2019 <connectionExpression><![CDATA[java.sql.DriverManager.getConnection("jdbc:postgresql://10.10.10.10:5432/my_db", "user", "pwd")]]></connectionExpression>10 years later ... and still saving me.Work well for me, thank you. 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