Friday, February 24, 2012

deploy shared datasources

Is there any way to deploy a report to the server and not have to reconfigure its reference to its shared data source?

For instance, if in the development environment my report is pointing to a data source called "MasterDB", and i deploy the RDL file to the server which has a data source called "MasterDB", it doesn't recognize the server-side data source. It informs me shockingly, inaccurately that

"The data source connection information has been deleted. (rsInvalidDataSourceReference)"

I have to go into the report properties and re-bind it manually.

Any thoughts on how to avoid this unnecessary step?

- Ian

If you deploy both the report and shared data source together and then modify the shared data source's properties in Report Manager (to point it to a production database rather than the development database), you can subsequently re-deploy the same report and/or additional reports without having to hook them up manually to the shared data source. (You can do this via VS.NET 2003 "Deploy" command or by uploading the RDL and RDS files from your dev machine to the Report Server.)

The <DataSourceReference/> in your RDL file can use a relative or absolute path to your RDS file. Typically they use relative paths. i.e. "Company Sales.rdl" has its <DataSourceReference/> set to AdventureWorks since AdventureWorks.rds is in the same folder as the RDL. Is this true for your RDS/RDL files? Are they in the same folder? If not, are their relative locations the same between your dev box and the deployment server?

N.B. In your Reporting Services project properties, you should leave the option "OverwriteDataSources" set to false (the default) to prevent subsequent project/solution deployments from overwriting changes to the shared data source.

|||

Thank you for your quick reply.

More specifically, this is the problem I'm having. Maybe there's a principle I haven't understood yet.

1. When I create the report in the IDE, I attach it to the data source called MasterDB, and code looks exactly like this :

<DataSources>
<DataSource Name="MasterDB">
<rd:DataSourceID>74b97554-7a77-4325-a8ad-4b7887aa7d54</rd:DataSourceID>
<DataSourceReference>MasterDB</DataSourceReference>
</DataSource>
</DataSources>

2. When I create the RDS file, The IDE seems to put this data source in a folder called \Shared Data Sources, but the relative path still seems to work despite the fact that the report is in a different folder.
3. In Report Manager, I use the New Data Source screen to create a matching datasource, but pointing to the server-side database.
a) as a variation, if I try to upload an RDS file using the "Upload File" screen, it does actually upload it, but doesn't recognize it as a Data Source. It just thinks it's some XML file.
4. If I have a valid data source on the server, say \MasterDB, and I upload my RDL file -- which still has a relative reference to MasterDB -- to the root, it still doesn't recognize the data source.
5. If i try to change the DataSourceReference to <DataSourceReference>\MasterDB</DataSourceReference>, my dev environment chokes.
6. If I upload the RDL file and go into the report's properties and specify it to point to the valid \MasterDB data source, the report works fine.

I think we're almost there. Any clarification?

|||

I believe you're right about RDS files displaying as XML if you go through Report Manager. I've always initially deployed them using VS.NET 2003. On the project properties, set your TargetServerURL to http://YourDeploymentServer/ReportServer. Set your TargetFolder to wherever you want your RDL and RDS files deployed to. (It will be created if it doesn't exist.) Now right-click your project or solution and select Deploy. Your RDL and RDS files are uploaded to the server. Usually, your Debug configuration should deploy to http://localhost/ReportServer and your Production (or Release) configuration should deploy to http://ProductionServer/ReportServer. Note that you can set up additional configurations that deploy to testing servers or elsewhere. I've used this technique numerous times and I never have to re-link my reports to my shared data sources. Hopefully you can get it working too.

When you're dealing with <DataSourceReference/>, the URL syntax uses "/". For instance, "/My Folder/MySharedDataSource". I suspect that this will still probably cause VS.NET to choke. The GUID in <rd:DataSourceID/> is only used by the Report Designer. So I don't think that's the source of your problem.

As for the RDL and RDS files being in different folders... This is only visual separation in the Solution Explorer. The files still exist in the same physical folder on your local hard drive, which is what's important. They should still upload to the same folder on the report server and their relative paths remain consistent.

|||Thanks, that got it.

- Ian

No comments:

Post a Comment