How to use 2 datasources from 2 differents from Oracle database in Jasper server

Hello,

I'm using Jasper server 8.0.2 version and I need to create a report using 2 queries from 2 different oracle databases.

 

What is the best option 2 define the 2 datasource. I have tried defining the databases as file as below

 

but i'm getting the error below when running the report

any recommendation or help on the setup to do will be much appreciated.

Sorry if this question was already asked and asnwered but i was not able to find it.

 

Thanks,

Frederic

ffranco_1's picture
Joined: Apr 9 2023 - 1:57pm
Last seen: 5 hours 5 min ago

Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.

arai_4 - 4 months 2 weeks ago

Thank you for your patience, we need a little more time with our team of experts to come up with a solution. We will respond back as soon as we have an answer to your question.

arai_4 - 4 months 6 days ago

1 Answer:

Your approach is fairly sound, although you might try checking the report in as an organization based user, which will change the path (removing the organization specific portion of the path.) With the org infor present it may make it so that the report doesn't work for a non-root user.

From a general strategy pint of view, here is some details on how to use multiple data sources in a report:

==============================

A report in JRS is actually a Report Unit, and a ReportUnit is not designed to use multiple data sources (JasperReports data sources). So if your data does not come from the same database (with which you may still pass the REPORT_CONNECTION to your subdataset) or is using the same JSON (for which you could derive a sub dataset), your best option is using data adapters. Any DatasetRun in JasperReports can run against a data adapter specified as a property.

You can create a ReportUnit referencing a (JRS) datasource, i.e. FoodMart. This is not mandatory.

Then, we assume that the chart gets its data from some JSON and the subreport uses an SQL query from a different database.

A Data Adapter in JRS is an xml resource that is uploaded either manually, or by using JSS.

The “binding” between a DatasetRun (which is the part of the report that defines how a subdataset gets its data), and the data adapter is configured in Jaspersoft Studio.

For a subreport, the main dataset will set the property net.sf.jasperreports.data.adapter

For Charts, Tables etc, it is always about using this property (Studio provides also the UI to specify the data adapter)

Be sure you point to a proper data adapter, which is a resource, inside your repository, just like you would do when you reference an image.

Studio will help you also loading these data adapters when the report is published to JRS.

===============

sanderse's picture
4516
Joined: Jul 31 2017 - 3:51pm
Last seen: 1 hour 21 min ago
Feedback
randomness