如何获取报告以查看共享数据源

发布于 2024-12-11 15:02:45 字数 652 浏览 0 评论 0原文

我正在运行 2008 R2,

我有一整套必须加载到 RS 中的报告。这些是由第三方开发并发送给我们公司的。它们连接到共享数据源。我将报告上传到按功能分隔的文件夹中。问题是他们看不到编写报告时使用的数据源。我创建了一个共享数据源并将报告指向它。连接测试成功,但当我运行报表时,我继续收到以下错误:

“报表服务器无法处理报表或共享数据集。报表服务器或 SharePoint 的共享数据源“dsMyObject”无效。浏览到服务器或站点并选择共享数据源。(rsInvalidDataReference)”

当我在嵌入数据源中使用完全相同的凭据时,报告会运行,在运行它后,我可以将其更改回我创建的共享数据源,并且它会运行。运行得很好。

我的问题是这个过程效率太低了,我有很多报告,还有更多的服务器来滚动这个过程,必须手动来回切换数据源才能使其工作。

我注意到,当我查看数据源列表时,我看到我创建的数据源的名称位于第一行,位置位于下一行(http://[服务器]/reports/[数据源文件夹] ])而供应商创建的 DS 的两行上都有 DS 的名称。这让我相信有一种方法可以将 DS 加载到 SSRS 中,其名称与供应商使用的名称相同,从而允许报告自动使用它们。我找不到任何东西告诉我如何做到这一点,所以我在这里问这个问题。如何获取预先编写的报告以查看将报告部署到的服务器上的共享数据源?

提前致谢,

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,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

冷血 2024-12-18 15:02:45

我知道这是一个非常老的问题,但我遇到这个问题是因为我在过去两天遇到了类似的问题。然而,根据我的经验,解决方案更简单 - 所以我会添加它,以防其他人将来搜索这个。

您需要在将报告部署到 RS 之前创建数据源。以下是我遇到的情况:

1) 我在添加数据源之前首先部署了它们,但它们不起作用:既不是来自我正在处理的应用程序,也不是来自 RS

2) 然后我创建了一个数据源,但没有起作用不要对现有报告做任何事情。我能够配置其中一些并将它们指向新的数据源,这很有效。如果您想批量执行此操作,您可能可以使用上面建议的 RS 实用程序,或者可能 类似的东西,但我还没有尝试过。

3)我尝试将报告重新部署到RS中,但是显然RS不会覆盖未更改的项目,因为重新部署的报告仍然没有获取数据源

4)然后我删除了现有报告并重新部署 - 这修复了它,他们直接就找到了数据源。

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.

幸福还没到 2024-12-18 15:02:45

这是SSRS的一大缺点。在 SSRS 中创建报表和数据源时,会在 ReportServer 数据库中为它们分配唯一的标识符。上传报告时,它们无法识别与构建报告时同名的现有数据源。

解决此问题的一种方法是使用 SSRS 附带的 rs.exe 实用程序。它可用于批量任务,包括在报告上设置数据源元数据。请参阅下面的链接了解更多技术信息。

RS 实用程序

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

夏夜暖风 2024-12-18 15:02:45

我发现解决此问题的最简单方法是简单地创建一个使用共享数据源的新报告。在 SSRS2012/VS2010 中,向导的第一页询问是否使用“共享数据源”或创建“新数据源”。采用第一个选项(并继续创建虚拟报告并保存它)会导致 RDL 包含节与节之间的节,如下所示:

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

我只是将此节复制粘贴到我想要的报告 RDL 中地点。它很乐意在预览期间和重新部署时使用该数据源。

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.

凉薄对峙 2024-12-18 15:02:45

使用共享数据源手动更新一份报告。在 [ReportServer].[dbo].[DataSource] 表中,记下该报表的“链接”值,然后只需更新 Name 栏目

update [ReportServer].[dbo].[DataSource]
set Link = '01B758F2-B597-43BE-A90F-416DF3CDA396'
where Name = 'PNLDS'
and Link is NULL

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
离鸿 2024-12-18 15:02:45

就我而言,我必须单击 SSRS 中报表右侧的下拉箭头,选择“管理”,然后选择“数据源”,然后浏览到报表需要使用的共享数据源的位置。

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.

泛泛之交 2024-12-18 15:02:45

感谢一个旧线程,但我试图找出 SSRS 是否可以报告它正在使用哪个共享数据源,以便我可以向 SSRS 报告添加警告,以防它在部署时仍然指向错误的数据源。诚然,我提出的解决方案仅在您为 Dev/UAT/Prod 使用不同的服务器时才有效,但您可以在 tsql 脚本中粘贴 @@SERVERNAME

我已经将其制作成案例陈述,我可以在我的报告中使用它,

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

这对我来说已经足够好了!

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!

薆情海 2024-12-18 15:02:45

绝对是SSRS的一大缺点。
这里发布了许多适合不同场景、技能和工具的好答案。
我在 Powershell 上使用 Sys.Net.WebServiceProxy 类添加另一个:

# 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)

说明:

主要思想是利用 Sys.Net.WebServiceProxy 类中的方法 SetItemDataSources(x, y) 将报告 x 上的数据源 y.name 设置为指向到数据源引用 y.item。
在我们的例子中,报告称为 TestReport,位于文件夹“/Reports”中,该文件夹通过名称“DStest”引用数据源“/Data Sources/DSTest”。
为了进行重新指向,我们需要创建对数据源 ($ds) 的引用,我们首先需要通过从 WebServiceProxy 对象 ($proxy) 的命名空间派生数据类型 DataSource 和 DataSourceReference 来定义数据源

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)

浴红衣 2024-12-18 15:02:45

我能够通过使用下面的 T-SQL 更新数据源链接来批量更新并解决问题。

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文