Change Datasource

Hi guys!, 
I'm trying to find the parameter for switch the datasource dynamically, It's possible?
Thanks for help me
Best regards
Oscar Romero
oscar16071987's picture
Joined: Apr 28 2014 - 2:57pm
Last seen: 8 years 2 months ago

1 Answer:

Hi Oscar,

You can try use parameter $P{REPORT_CONNECTION} for change datasource dynamically.

ybablyuk's picture
Joined: Oct 17 2012 - 12:51am
Last seen: 4 years 3 months ago

Thanks for help me yurab.

Currently I have this JasperServer version:
Product Version: 4.7.0
Build: 20120815_1737

But the parameter is ignored or something else, We are using the same report for 2 different databases.

I'm sending the parameters like this...

I'm using a PHP Library and PARAM_XXX is required for this lib. Everything works only the REPORT_CONNECTION it doesn't.

Thanks for your help

Best regards,
Oscar Romero

oscar16071987 - 8 years 9 months ago

Thanks for help me yurab.

Finally I've found a different solution, Is quite strange. I'm sending a DataSourceID parameter...

And In SQL Editor something like this

SET @iDSNumber = $P{DataSourceNumber}

IF @iDSNumber = 1
SET @cDBName = 'Contoso'
SET @cDBName = 'Fabrikam'

EXEC (@cDBName + '.dbo.Procedure ' + '[' + @cCustName + '], ' + @iCountry)

oscar16071987 - 8 years 9 months ago

If you whant to know report->datasource dependencies use this query :

select * from jireportunit, jijndijdbcdatasource, jiresource
where reportDataSource = and
jndiName='jdbc/mysourcename' and ;

massimo.loporchio - 6 years 9 months ago