Jump to content
Changes to the Jaspersoft community edition download ×

date_source does not work when specified in the URL

Go to solution Solved by Raphaël Peguet,

Recommended Posts

Hello, I am using Jasperserver version 8.1.1 and I want to generate a report via URL, but when I specify the data source in jdbc_datasource, my report is empty. However, the data source is entered correctly and if I use this data source in the report itself, it works fine, but not through jdbc_datasource. What could be the problem?

Here is the URL: http://localhost:8080/jasperserver/rest_v2/reports/Reports/TEST/UAF.pdf?&j_username=a&j_password=a&jdbc_datasource=TEST

I have read the Authentication Cookbook and JasperReports Server Administrator Guide, but still could not find the issue.

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...

When you deploy a report to JRS (JasperReports Server) from JSS (Jaspersoft Studio) you also need to link the report to a data source connection already created on the server.
The report deployed on the server will (generally not use the data adaptor from the Studio although there are a couple of exceptions.
Creating the datasource connection in JRS is described at https://community.jaspersoft.com/documentation/tibco-jasperreports-server-community-project-administrator-guide/v80/jdbc-data-sources#kanchor180
To use a JRS datasource connection in a report you may:

  1. do it from JSS when publishing it in the server as described at https://community.jaspersoft.com/documentation/tibco-jaspersoft-studio-user-guide/v8/publishing-report-jasperreports-server#kanchor275
  2. or you may define it in the settings (right click on the report and press edit from the repository) as described at https://community.jaspersoft.com/documentation/tibco-jasperreports-server-community-project-administrator-guide/v80/jasperreport

Please let me know if you need more info otherwise please marked this answer as the correct answer.

Link to comment
Share on other sites

Hello rpeguet
  Thanks for the answer, but that's a little off the mark. I have data sources and a report connected to them, but the problem is that there are 14 data sources and this report should work in all sources. that is, in order to receive the required amount of information, I need to create 14 copies of the report and connect it to different sources. I would like to ask you for help, maybe you know how you can dynamically connect to sources or how to make it easier to add 14 copies and connect to the same number of sources. There are a lot of such reports and it will take a lot of time to add each one manually.

Link to comment
Share on other sites

Hi Deadsploid,

In your case then you need to make the datasource connection used by the report dynamic using profile attributes.
This is described in Chapter 4.1 Attributes in Data Source Definitions of the Admin guide.

This means you will need to have different users for each database so that the same report can run against a different DB based on the logged in User ID.  Would that work for you?
It is currently not possible to set the datasource connection through a parameter value so the alternative would be to build your own datasource connection and make it dynamic as you prefer.

I hope this helps,

Link to comment
Share on other sites

I'm sorry to distract you again. I read this section, but I didn't understand anything. Do I need an account in the database and on the jasperserver to have the same names ? If you don't mind, please describe. Thank you very much in advance and I sincerely apologize

Link to comment
Share on other sites

  • Solution

No worries, I am happy to help.
The users in JRS don't need to be the same as the DB users, you create the users in JRS as you prefer and several users will use the same DB connection if they share the same profile attributes values defining the DB connection info.
I have created a sample in my github at https://github.com/raphpeguet/JRS-demo-dynamic-DB-connection but I'm not sure if the import in the community edition of JRS will work since the export was done from the enterprise edition. If it doesn't work maybe you could create a new JRS instance using the free trial environment with the installer you get from jaspersoft.com/download.

I hope this helps,

Thank you for upvoting, downvoting or selecting the best answers in this thread to help us improve the experience on this forum.

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...