JDBC datasource switch based on query params

Hi,

Just wondering can one switch or choose the JDBC datasource a report uses to generate data based on query params? 

I have a use case where one single report template is requried, but coud point at several datasources. I would like to be able to do the report without having to make several copies of the same template hardcoded to use a speciific data source. 

Best,

Mark

markwilliamson101's picture
Joined: Feb 23 2017 - 8:45am
Last seen: 6 years 2 months ago

2 Answers:

If this is in the server, you might be able to use attributes:

http://community.jaspersoft.com/documentation/tibco-jasperreports-server...

However, you can't use report parameters in the query, because the datasource is loaded before parameters.

elizam's picture
14286
Joined: Mar 5 2012 - 9:19am
Last seen: 2 years 9 months ago

If you are programming, you can just dynamically set the datasource to pass to the report. That's what I do.

hozawa's picture
176403
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 11 months ago
Feedback