Change Datasource
Posted on April 28, 2014 at 3:03pm
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
Joined: Apr 28 2014 - 2:57pm
Last seen: 8 years 2 months ago
Posted on April 29, 2014 at 11:50pm
Hi Oscar,
You can try use parameter $P{REPORT_CONNECTION} for change datasource dynamically.
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...
http://
localhost/doreport.php?uri=/reports/customers/s04&PARAM_dm=0&format=PDF&PARAM_REPORT_CONNECTION=DATA_SOURCE_NAME
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
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
DECLARE @cDBName VARCHAR(100)
DECLARE @iDSNumber INTEGER
SET @iDSNumber = $P{DataSourceNumber}
IF @iDSNumber = 1
SET @cDBName = 'Contoso'
ELSE
SET @cDBName = 'Fabrikam'
EXEC (@cDBName + '.dbo.Procedure ' + '[' + @cCustName + '], ' + @iCountry)
If you whant to know report->datasource dependencies use this query :
select * from jireportunit, jijndijdbcdatasource, jiresource
where reportDataSource = jijndijdbcdatasource.id and
jndiName='jdbc/mysourcename' and jireportunit.id=jiresource.id ;