Change Datasource

0
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: 4 years 4 months ago

1 Answer:

0

Hi Oscar,

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

ybablyuk's picture
128
Joined: Oct 17 2012 - 12:51am
Last seen: 6 months 1 week 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

oscar16071987 - 4 years 12 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
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)

oscar16071987 - 4 years 11 months ago

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 ;

massimo.loporchio - 2 years 11 months ago
Feedback
randomness