Jump to content
Changes to the Jaspersoft community edition download ×

Copy jasper reports from one folder to another in jasper server


saha.nabajyoti

Recommended Posts

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.

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

Link to comment
Share on other sites

Thanks a lot Srang.I know your method will work but as you know,it is also very hectic process and client will not agree with this solution.Anyway thanks a lot for yourhelp.                                                                                        

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 6 years later...

Hi, I have found an easier way. 

  1. Put the datasource in 'report' folder, NOT in 'data source' folder. 
  2. In Folder 1, before export, point the datasource to desired new database
  3. From Folder 1, export. 
  4. In Folder 2, import.
  5. You will find that all reports in Folder 2 now pointing to the new database
  6. 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)

 

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