Jump to content
Changes to the Jaspersoft community edition download ×

[SOLVED] Different Report connections for Subreports for Jaspersoft Studio


ckampshoff

Recommended Posts

Hi at all,

I'm trying the new Jaspersoft Studio (CE 5.6.1 final) and I was wondering if there's a possibility to use different data source (other than the one for the main report) for every subreport in one main report. In iReport I'm able to do that by using the "com.jaspersoft.ireport.designer.utils.Misc.getConnection("my datasource")" but I didn't find anything simple like that for the Studio. Only a hint for something like this: net.sourceforge.jtds.jdbc.Driver("jdbc:jtds:sqlserver://192.168.0.144","user","password"). I don't want to write my user and password combination in clear text into my report. Has someone a workaround for this and is it possible to get this on the Jasperserver to work?

Kind regards Christina

Link to comment
Share on other sites

  • 3 months later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 3 weeks later...

It’s complicated for Jasper to allocate different data sources for every subreport and the master report, with implicit user name and password. In this case you can try using esProc to help Jasper out from the difficulty.


 


If, for instance, the data for use in the main report are stored in MySQL, you can retrieve them using this esProc script: result mysql1.query("select * from emp")


 


If the data for use in the subreport are stored in MSSQL, in which they relate to the main report through SellerId field, then you can retrieve data using this line of script :result msSQL1.query("select * from sales where SellerId=?",eid).


 


For Jasper, esProc is like a JDBC data source (its name is, say, esProcConn). Different esProc scripts are different stored procedures under the same data source. Thus you can select “Use same connection used to fill the master report” in configuring data source for different subreports.


 


For more details, see http://blog.raqsoft.com/?p=2621 .


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...