Jump to content
We've recently updated our Privacy Statement, available here ×

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


ffranco_1
Go to solution Solved by Scott Andersen,

Recommended Posts

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

converted-file.png.ff8fcc980da7c9c218ef5824491e011e.png

 

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

converted-file.png.40eaa064eb77eb1dd622a6cc969d384d.png

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

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...
  • 2 weeks later...
  • Solution

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.

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...