17

I am running 2008 R2

I have an entire set of reports that I have to load into RS. These were developed and sent to our company by a third party. They connect to a shared data source. I uploaded the reports into folders that separated them by function. The problem is that they don't see the data source that the reports are written to use. I created a shared data source and pointed the report to it. The connection tested successfully but when I ran the report I continued to receive the following error:

"The report server cannot process the report or shared dataset. The shared data source 'dsMyObject' for the report server or SharePoint is not valid. Browse to the server or site and select a shared data source. (rsInvalidDataReference)"

When I used the exact same credentials in an embedded data source the report runs and after I get it to run I can change it back to the shared data source I created and it runs just fine.

My problem is that this process is too inefficient I have to many reports, and many more servers to roll this too, to have to manually switch the data source back and forth in order for it to work.

I noticed that when I look through the list of data sources I see the ones that I created with the name of the DS on the first line and the location on the next (http://[Server]/reports/[Data Source Folder]) while the DS created by the vender have the name of the DS on both lines. This leads me to believe that there is a way to load the DS into SSRS with the same name the vendor used in such a way to allow the reports to automatically use them. I can’t find anything that tells me how to do this so I am asking this question here. How do I get prewritten reports to see a shared data source on the server I deploy the reports to?

Thanks in advance,

NomadicDeveloper
  • 857
  • 4
  • 17
  • 29

8 Answers8

17

I know this is a really old question but I came across this as I was facing a similar issue over the past two days. However, in my experience the solution was simpler - so I'll add it in case someone else searches for this in the future.

You need to create your data source before you deploy your reports into RS. Here's what happened for me:

1) I first deployed them before adding a data source, and they didn't work: neither from the application that I'm workin on, nor from RS

2) I then created a data source but that didn't do anything to existing reports. I was able to configure some of them and point them to the new data source, and that worked. If you want to do this in bulk, you could probably use the RS Utility as suggested above or probably something like this, however I haven't tried these.

3) I tried redeploying the reports into RS, however apparently RS doesn't overwrite items that haven't changed as the redeployed reports still didn't pick up the datasource

4) I then deleted existing reports and redeployed - this fixed it and they picked up the data source straight away.

Boris
  • 1,180
  • 1
  • 18
  • 29
13

This is a big shortcoming of SSRS. When reports and data sources are created in SSRS, they are assigned unique identifiers in the ReportServer database. When reports are uploaded, they do not recognize an existing data source with the same name the report was built with.

One way around this is to use the rs.exe utility that comes with SSRS. It can be used for bulk tasks, including setting data source metadata on reports. See the link below for more technical information.

RS Utility

Brian Knight
  • 4,970
  • 28
  • 34
5

I found the easiest way to resolve this was to simply create a new report that DOES use the shared data source. In SSRS2012/VS2010, the first page of the wizard asks whether to use a "Shared data source" or to create a "New data source". Taking the first option (and continuing on to create the dummy report and save it) results in an RDL containing a section between the section and the section, something like this:

  <DataSources>
    <DataSource Name="shared_datasource_name">
      <DataSourceReference>shared_datasource_name</DataSourceReference>
      <rd:SecurityType>None</rd:SecurityType>
      <rd:DataSourceID>f00b5045-1a8c-44be-952b-cca1ce9c57d6</rd:DataSourceID>
    </DataSource>
  </DataSources>

I just copy-pasted this section into my intended report RDL in the same location. It happily uses that datasource during preview and when re-deployed.

AdvApp
  • 1,094
  • 1
  • 14
  • 27
5

Update one report manually with shared datasource. In the [ReportServer].[dbo].[DataSource] table, note the "Link" value for that report, then simply update the reset that have the Datasource in the Name column

update [ReportServer].[dbo].[DataSource]
set Link = '01B758F2-B597-43BE-A90F-416DF3CDA396'
where Name = 'PNLDS'
and Link is NULL
Liam
  • 27,717
  • 28
  • 128
  • 190
Schmed
  • 51
  • 1
  • 1
  • 1
    Where did you get the `01B758F2-B597-43BE-A90F-416DF3CDA396` from? – Liam Jan 31 '18 at 10:46
  • @Liam Create a dummy report as explained in the answer by IronRod [here](https://stackoverflow.com/a/31146568/990349), then open the RDL file in a text editor. – pholcroft Nov 26 '21 at 08:57
3

In my case I had to click the drop-down arrow at the right of the report in SSRS, select "Manage", then "Data Sources", then browse to the location of the Shared Data Source the report needs to use.

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
2

Appreciate an old thread but I was trying to find if SSRS can report which shared data source it's using so i could add a warning to an SSRS report in case it was still pointing at wrong data source when deployed. The solution i came up with admittedly only works if you're using different servers for Dev/UAT/Prod but you can stick @@SERVERNAME in your tsql script.

I've made it into a case statement that I can bung on my reports

select case @@SERVERNAME when 'Prodserver' then '' 
else 'WARNING: This report is not looking at production data!' end as ServerWarning

Works well enough for me!

Jim
  • 569
  • 6
  • 15
2

Definitely a big shortcoming of SSRS. Many good answers posted here which suit different scenarios, skillsets and tools. I'm adding another one using Class Sys.Net.WebServiceProxy on Powershell:

# Create WebServiceproxy object
[string] $WebServiceUri="http://localhost/ReportServer/ReportService2010.asmx?wsdl"
$proxy=New-WebServiceProxy -uri $WebServiceUri -UseDefaultCredentails

# Define required data types (DataSource and DataSourceReference) and instantiate
$typeds=($proxy.gettype().namespace) + '.DataSource'
$ds=new-object -TypeName $typeds

$typedsref=($proxy.gettype().namespace) + '.DataSourceReference'
$reference=new-object -TypeName $typedsref

# Set data source object with reference and name
$reference.Reference="/Data Sources/DStest" # path/name of the data source
$ds.Item=$reference
$ds.Name="DStest" # name of the data source on the report

# Repoint data source on report
$ReportPath="/Reports/TestReport" # path/name of the report
$proxy.SetItemDataSources($ReportPath, $ds)

Explanation:

The main idea is utilise the method SetItemDataSources(x, y) from class Sys.Net.WebServiceProxy to set the datasource y.name on report x to point to the datasource reference y.item. In our case the report is called TestReport, located on folder "/Reports" which references data source "/Data Sources/DSTest" by the name "DStest". In order to do the repoint we need to create a reference to the data souce ($ds) for which we first needed to define the data types DataSource and DataSourceReference by derived them from the namespace of the WebServiceProxy object ($proxy)

Jayvee
  • 10,670
  • 3
  • 29
  • 40
  • 1
    This seems an awful lot of code to do something that's pretty simple to do with a [couple of lines of SQL](https://stackoverflow.com/a/33767544/542251).. – Liam Jan 31 '18 at 10:28
  • 1
    Yes, it is quite a bit of code but if there is need to deploy multiple reports as part of an automated process, this powershell script might come in handy. – Jayvee Jan 31 '18 at 10:43
  • 1
    Turns out that delving into the SQL isn't as straight forward as it appears anyhow?! The table data is pretty cryptic.. – Liam Jan 31 '18 at 10:45
1

I was able to bulk update and fix the problem by updating the data source link using the T-SQL below.

begin tran
update dbo.DataSource
set Link = c.ItemID 
from dbo.DataSource ds 
inner join dbo.Catalog c
on ds.Name = c.Name
and c.Type = 5
where ds.link is null

select ds.Link oldlink, c.ItemID 
from dbo.DataSource ds 
inner join dbo.Catalog c
on ds.Name = c.Name
and c.Type = 5
--where ds.link is null


select *
from dbo.DataSource ds 
where ds.link is null

rollback tran
-- commit tran 

http://tsqlblog.blogspot.co.uk/2011/05/rsinvaliddatasourcereference-on.html

Liam
  • 27,717
  • 28
  • 128
  • 190
William Tait
  • 61
  • 1
  • 2