How to change DataSourceReference at run time using REST API

0

Hello All,

I am beginner in jsasper reports.

I have created a report using ireport 5.5.0 and deploy it in jasperserver 5.5.0.

I am able to run from my web application using REST API.

Now i have a requirement to chagne the datasource reference at run time.

More specific:   Currently i am using the PostgreSql as a database.

There might be requirement that i need to use MySQL (at run time) having database with same name and schema.

So, pleaes tell me how can i change the datasource reference using REST webservice.

Thanks

admin.vizexperts's picture
Joined: Feb 25 2014 - 2:53am
Last seen: 7 years 9 months ago

2 Answers:

-1

Why don't use just create 2 reports to use as a data source- one using PostgreSQL as a resource and another using MySQL. In your report, just change the url to get the data.

hozawa's picture
78182
Joined: Apr 24 2010 - 4:31pm
Last seen: 2 years 7 months ago

Thanks hozawa for your prompt reply.
I can do this, but our requirement is to call same template but with different data source as per requirement.

admin.vizexperts - 7 years 10 months ago
0

If your look at the jrxml file, you'll find that datasource is just a data in CDATA. Have you tried parameterizing it? That way you can just send parameters to switch.

hozawa's picture
78182
Joined: Apr 24 2010 - 4:31pm
Last seen: 2 years 7 months ago

I am to parameterize the queryString, but not found any info for dataSourceReference.
That we need to define at the time of deployment of report into jasperserver.
In addition i have not added any datasource at the time of deployment. I have taken a parameter for datasource.
From my web application I have passed the already added database(in jasperserver) reference to my xmlstring. But it is showing blank report.

admin.vizexperts - 7 years 10 months ago
Feedback
randomness