Hi Jasper Gurus,
In jasper server 5.2,we have created a folder(suppose FOLDER 1) and deployed few reports in that folder with datasource(suppose DATASOURCE 1) for each reports.
Now we copied all the reports and pasted it in a different folder(suppose FOLDER 2).All the reports of FOLDER 2 are attached with same datasource(DATASOURCE 1)
which the reports of FOLDER 1 are using.Now if we create another datasource(suppose DATASOURCE 2) and want to attach each reports of FOLDER 2 to connect DATASOURCE 2
instead of DTASOURCE 1 ,we have to manually edit each reports of FOLDER 2 and attach the new datsource i.e DATASOURCE 2.This whole process is very hectic and time consuming too.
Is there any simple way so that we can change the datasource easily without editing each reports of FOLDER 2 individually.Please suggest.We need the solution urgently.
6 Answers:
I've had the same problem and I've come up with a less time consuming way but its not much easier, so it really depends on how many reports you need to change the datasource for. What I do when I need to change the datasource for a large number of reports is I'll change the datasource for just one report and then export the folder to .zip (if you don't change one of the datasources it won't be included in the zip and then you can't import the update), then use grep -rl <old_datasource_path> and make sure my regex is good then pipe that into xargs sed -i 's:<old_datsource>:<new_datasource>:g' and then rezip the whole thing back up and then import it back into the server. so those steps again are:
1) make one of the reports in your folder point to your new datasource
2) export your report folder
3) run : 'mkdir test && unzip export.zip -d test && cd test' from your downloads folder
4) then run: 'grep -rl 'old_datasource_name' | xargs sed -i 's:old_datasource_name:new_datasource_name:g'
5) zip -r foo.zip ./*
6) Import foo.zip into my server
Another option you might want to try is use organization/tenant/user attributes to dynamically determine the host of your datasource and have all of your reports point to a single datasource object. To get this to work across organizations would be to have the datasource in a public folder and restrict access to execute/read.
Hi, I have found an easier way.
- Put the datasource in 'report' folder, NOT in 'data source' folder.
- In Folder 1, before export, point the datasource to desired new database
- From Folder 1, export.
- In Folder 2, import.
- You will find that all reports in Folder 2 now pointing to the new database
- Change the datasource in Folder 1, pointing back to its original database
Hope you can try and give me feedback.
(Basically I created this steps based on Hazawa's hint)