How To Save Credentials In SSRS Local Report - reporting-services

I'm trying to run a report that can connect to the database and run. I've added multiple datasets to the data source that I created inside the report. I am trying to run this programmatically, inside WebApi and return a PDF. When I render the report I get an error that says:
ReportProcessingException: Plant
Plant is one of my DataSet names inside the report, So I went to the Query in Plant and ran it inside Sql Server Management Studio without any errors.
Next I decided to look at the XML on the report and it looks like this:
<DataSources>
<DataSource Name="DataSource1">
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString>Data Source=.\SomeInstance;Initial Catalog=SomeDataBaseName</ConnectString>
<Prompt>Specify a user name and password for data source DataSource1.</Prompt>
</ConnectionProperties>
<rd:DataSourceID>f4a33a86-c8f5-4fef-8e92-903b536c45dc</rd:DataSourceID>
<rd:SecurityType>DataBase</rd:SecurityType>
</DataSource>
</DataSources>
And I noticed that there are not any credentials for the database.
I also noticed that every time I close, reopen, and run the report it asks for the database credentials.
So I decided to try to add the credentials in the connection string like:
<ConnectString>Data Source=.\SomeInstance;Initial Catalog=SomeDataBaseName;User Id=SomeUser;Password=SomePassword</ConnectString>
ending up with the same result as before.
So then I decided I would just delete all but one of the data sets and see if that worked, I had the same error only with the remaining data set.
How can I get the report to connect to the database and run using LocalReport, and not ServerReport?

You can create new report parameter called, for instance, ConnectionString.
When calling the report from your code, pass the connection string to the parameter, or instead of it, just set parameter's default value inside report.
In the report set this parameter as DataSource's Connection string.

Related

Can't subscribe to ReportBuilder report in SSRS 2008-r2

When a user tries to subscribe to a report created via ReportBuilder they receive the following error: "Subscriptions cannot be created because the credentials used to run the report are not stored, or if a linked report, the link is no longer valid."
As far as I can tell the credentials ARE being stored, but report server seems to be ignoring them. We are able to subscribe to non-ReportBuilder reports using the same data source just fine.
We have been trying to track down the problem for several weeks now and haven't gotten anywhere. Any help would be greatly appreciated.
The report uses a shared data source on its model. This is the only model defined on the server:
The model uses the following data source defined on the server (this is the same data source that other reports use, and it's the only data source stored on the server.):
The Data Source is set to store the credentials on the report server (you can see the results of testing the connection at the bottom of the screenshot):
You cannot subscribe to a Report Builder report that uses a model as a data source if the model contains model item security settings. Could this be the cause of your issue?

Create a shared datasource in VS2012 for SSRS

I'm just looking to create a shared datasource in VS2012 without selecting an entire database scheme. We'll mostly put doing all the dataset queries by sql query.
I found this but i'm still unable to create a shared datasource.
http://msdn.microsoft.com/en-us/library/ms159165.aspx
For an embedded data source, verify that Embedded connection is selected. Does not exists.
So how do you create a shared datasource in VS2012 with just a connection string?
A DataSource is just a connection string in an element in an xml structure as far as SSRS is concerned. A shared one is just one kept as it's own object and then the rdl elements(reports) have a reference in their xml to that object. Think of an rds file (data source for SSRS) as this very similar to .NET standard connection strings:
Data Source=(server);Initial Catalog=(database)
Plus you can store credentials to mock who is running the report. Thus you can make a proxy user to run the database connection. However SSRS does this through a GUI called 'Business Intelligence Development Studio' it is an add on to Visual Studio that is generally SQL Server version matches that VS version EXCEPT FOR 2012. That one creates a shell Visual Studio of VS 2010 just meant for BIDS.
To my knowledge you should be creating these directly in BIDS and not try to hack the RDS file directly unless you get the ReportService2010.asmx web service to mess with it's properties in .NET (which is a lot more work.).
To add one you just do this:
Go into BIDS with a report project
Expand a project
Right Click 'Shared Data Sources'> 'Add New'
Click 'Edit...' next to connection string
You get a menu very similar to ADO.NET standard connection string creator
Put in ServerName
Put in DatabaseName
8*** Optional put in default credentials.
Click OK
Generally SSRS has three parts to everything it does
Datasource = connection string (rds file when not embedded)
Dataset = select query or proc results or other data source return (rsd file when not embedded)
Report = resultant xml display of elements such as parameters, tables, matrices, etc. (RDL file when working on hosted report)
Generally reports can have everything embedded or else just reference everything they use. References are often easier for deployments sake as SSRS is designed to look if DataSources first exist and NOT OVERWRITE them by default. Thus if you reuse a datasource it is much easier in the long run as long as policy for it is set up correct.
If you want to just know the structure of an rds file they look like this:
<?xml version="1.0" encoding="utf-8"?>
<RptDataSource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="Test">
<ConnectionProperties>
<Extension>SQL</Extension>
<ConnectString>Data Source=TestServer;Initial Catalog=TestDatabase</ConnectString>
</ConnectionProperties>
<DataSourceID>45be0ac1-80a8-4d5c-906b-c13b03298e0a</DataSourceID>
</RptDataSource>

How to make Report Server skip database authentication and hide parameters prompt

I'm new on Report Server and I'm facing two problems.
I'll give you some information and then I explain them.
I've created a Report Server Project and inside it, I also created a Shared Data Source, which has the user ID and password to grant access to a Sql Server 2005 Data Base. But my report server was created on Sql Server 2008 R2.
After I created the Shared Data Source, I made a Shared DataSet, which uses the Shared Data Source as Data Source. The command type used on this DataSet was "Stored Procedure", this procedure receives parameters, so, the DataSet also receive these parameters.
Then, I created a Report, I drag the DataSet to this Report and it automatically created the parameters report.
Let's separate the problems...
First Problem: How to Hide the Report Parameters Prompts when the Report is accessed by URL
When I run the Report by righ-clicking the .rdl file and click on "Run", the parameters prompt aren't shown, but when the report is accessed from outside (after it is deployed on the Report Server) by URL, the parameters prompts are shown.
What can I do to change this behavior? I've already tried to set the tag as following:
<Hidden>true</Hidden>
But it keeps doing the same thing.
The following is the code snippet of my Report Parameters.
<ReportParameters>
<ReportParameter Name="IDFUNC">
<DataType>Integer</DataType>
<DefaultValue>
<Values>
<Value>
10
</Value>
</Values>
</DefaultValue>
</ReportParameter>
<ReportParameter Name="dtInicial">
<DataType>DateTime</DataType>
<DefaultValue>
<Values>
<Value>
06/01/2012
</Value>
</Values>
</DefaultValue>
</ReportParameter>
<ReportParameter Name="dtFinal">
<DataType>DateTime</DataType>
<DefaultValue>
<Values>
<Value>
09/01/2012
</Value>
</Values>
</DefaultValue>
</ReportParameter>
</ReportParameters>
I've already tried to make these parameters Hidden on the Report Parameter Properties Dialog Box too. But in this case I get the message error "<Prompt:> Enter a prompt for the parameter".
Just to be clear, I'll pass the parameters I need by QueryString (URL).
Second Problem: Report asks for Data Base Credentials when loading the Report (just when by accessed by URL)
How to make the Report skip the Data Base authentication when it is accessed by URL?
Well guys, this is everything.
If you want more information to help me, just ask.
Thanks.
What you are looking at is propogation issues: Reporting Services doesn't propogate authentication credentials so you need to open the datasource on the server using the browser and open its properties and enter the credentials in there again. This is done for security reasons and you only need to update the credentials on the server once.
Similarly, sometimes when parameters change they don't get propogated either (if the Reporting Services server thinks you have modified the parameters from their deployed settings - it keeps the modified values for you). You may need to update the parameters on the server again using the browser. Select Manage Parameters for that report and set them to hidden. Deleting and re-deploying the report may also work.

Reporting Services Expression-based Connection Strings can't have any data driven parameters

I need my reports to have dynamic connections strings. We have multiple database servers and catalogs and only want to maintain a single Report file. The only solution I could find that would let me do this programmatically was "Expression-based Connection Strings". Basically I programmatically pass in parameter values to the report for the ServerName and InitialCatalog.
This works for simple reports. Although not ideal as modifying the report requires changing the connection to a hardcoded connection string and then switch back to the expression-based one when I want to save and publish.
HOWEVER, this does not work for reports that have data-driven parameters. For example I have a report that filters data based on a "City" parameter that the user selects when they first open the report. The City parameter is feed data from a query. It seems that I can't just set the connection parameters and let reporting services query for the City parameter.
I'm open to ideas here other than "Expression-based connection strings".
Thanks.
I had the same problem. The solution was surprisingly simple - just move your "ServerName" and "InitialCatalog" to the top of parameter list.
A possible option is to create a deployment script(which uses rs.exe) and deploy multiple versions of the report. In the deployment script you can update the datasource of the report. Your source control would still only have one report and each time you released it you run the script to update the multiple copies you have in production.

Using a shared data source for dynamically generated and deployed reports

I'm dynamically generating RDL files for SSRS 2008, assembling my reports from "building blocks" which I defined as reports on Report Server, and which I use as subreports on my generated report.
On my Report Server, I have a single, shared data source which does work as long as I run stuff directly on the report server.
What I'm trying to accomplish is this:
my generated main report should reference that shared data source
my subreports contained on the generated main report should also use the same data source
after I deploy the report to report server using the webservice interface, I'd like to be able to actually see the report right away
For now, I can generate and validate my RDL just fine, I can deploy it to the report server just fine, too - it shows up and all, great.
But when I try to view the report, I get an error that my data source is invalid or has been removed or something.......
What am I missing?? I am pretty sure I have the right data source - GUID for it and all - and the names do match. How do I tell a generated RDL to use the shared data source already present on the server??
Answering my own question here, hoping someone else might find this useful:
I was under the (false) impression that the unique "DataSourceID" given to a data source on the server would be sufficient to identify it uniquely.
So in my generated RDL, I had something like :
<DataSources>
<DataSource Name="MyDataSource">
<Transaction>true</Transaction>
<DataSourceReference>MyDataSource</DataSourceReference>
<rd:DataSourceID>6ba7c588-e270-4de9-988c-d2af024f10e1</rd:DataSourceID>
<rd:SecurityType>None</rd:SecurityType>
</DataSource>
</DataSources>
Now this worked once, when my data source was indeed called "MyDataSource" and located in the same directory as my report which I published through the RS WebService API.
As soon as I moved the data source elsewhere, it stopped working.
THE SOLUTION:
This may sound silly, but I really didn't "get it" at first: the DataSourceReference needs to have the full and complete "path" on the Reporting Server to that data source I want to reference. Just specifying the unique ID won't do....
So once I changed my RDL to:
<DataSources>
<DataSource Name="MyDataSource">
<Transaction>true</Transaction>
<DataSourceReference>/MyProject/DataSources/MyDataSource</DataSourceReference>
<rd:DataSourceID>6ba7c588-e270-4de9-988c-d2af024f10e1</rd:DataSourceID>
<rd:SecurityType>None</rd:SecurityType>
</DataSource>
</DataSources>
(notice the <DataSourceReference>/MyProject/DataSources/MyDataSource</DataSourceReference>)
since that moment it works like a charm.
Hope someone might find this useful some day!