Setting datasource/db connection at report runtime

0

Hello,

I'm trying to figure out how best to implement reports for a multi-tenant system where each tenant has their own database. Our goal is to build reports that can be run against any customers database without having to set up specific reports or connection details which are stored on the server. I'd like to create a generic report and be able to pass in the connection details. I'm not sure if this has any impact but we're running against a Mongo database.  Our set up is that we are hosting and running reports from the JasperSoft report server and running reports thorugh the REST Client (Java). Right now we have a hardcoded DataAdapter which sets up a connection to a known tenant just to verify the report layout. I have seen examples of being able to do pass the report the connection details at runtime but that was for the embedded solution. Is it possible to create a report that is static in the query but is able to be executed against a specific tenant at runtime? I have been searching for a few hours and felt I would reach out since I'm not having much luck up to this point. Any help of guidance would be much appreciated. 

-Doug

dfarmer's picture
Joined: Jun 11 2018 - 1:56pm
Last seen: 1 year 1 month ago

1 Answer:

0

You can create a separate jasper reports user for each client database, then add user attributes for each user that specify the db, port, credentials, etc in the JDBC connection on jasper server. This is definitely doable if you can authenticate with a different user to Jasper Server depending on the client in use.

Example: Client A authenticates to JasperServer with User A, with User A attributes defined that connect to Client A's database.

https://community.jaspersoft.com/documentation/tibco-jasperreports-serve...

Using the REST client with this approach is a non-issue, the REST client would specify the Jasper Server user to authenticate with. Hope this helps.

darth_fader's picture
Joined: Mar 7 2010 - 9:45pm
Last seen: 1 month 1 day ago
Feedback