[SOLVED] Different Report connections for Subreports for Jaspersoft Studio

0

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

ckampshoff's picture
Joined: Sep 23 2009 - 6:25am
Last seen: 1 month 1 day ago

3 Answers:

0

Do you have any update regarding this issue? 

luca.frisetti's picture
Joined: Nov 29 2013 - 2:00am
Last seen: 4 years 8 months ago
0

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 .

calculate.machine's picture
Joined: Jan 13 2015 - 11:40pm
Last seen: 5 years 4 months ago
0

Hi,

thanks for your answer.

We solved this issue with the using of an own Scriptlet. We're able to give the database name and the scriptlet connect to the correct oracle database the user selected from a drop down list. At the end of the report we close the connection.

ckampshoff's picture
Joined: Sep 23 2009 - 6:25am
Last seen: 1 month 1 day ago
Feedback