Dynamic datasource in SSRS - sql-server

I am working on a report which will pull all sysadmin login's from each server. So I used below data source properties and created parameter names:
servername ="data source=" & Parameters!Servername.Value & ";initial catalog= master"
above solution working fine in SQL Server Data tools but when I deploy in report server I am getting error on connection error's like below.
An error has occurred during report processing. (rsProcessingAborted)
Cannot create a connection to data source 'dSource_DbOwner'.
(rsErrorOpeningConnection) Format of the initialization string does
not conform to specification starting at index 0.
Please let me know all your inputs
Thanks, Ven

SSRS can be annoying sometimes with plain text. I would suggest going into the connection manager and using the wizard. I believe it is a button with build on it to the top right hand side of where you are inputing this text. That will create the connection easily and it wont spit and sputter at the connection string.

Related

SSRS - can connect two datasets but not three

I'm making my first report with Sql Server Reporting Services (2012) and have managed to create two datasets successfully, each one connecting to the same Data Source. This Data source uses an embedded connection and the user can select the server and Database at runtime. The connection string is as follows
="data source=" & Parameters!ServerName.Value & ";initial catalog=" & Parameters!DatabaseName.Value
The two parameters in question are created and everything works fine for these two datasets, the report displays with a choice of servers and databases and displays the relevant data when I click on Show Report.
However, when I try to add a third DataSet (I need a separate SQL command to pull separate data for the footer and header) this one doesn't connect.
I've tried the following:
-Right click on the existing data source to create the data set, selecting the existing source. When I open the query designer it fails to connect
-Create a new data source with a fixed connection string. This works but is not what I want
-Create a new data source with another name and the same connection string as the original. This fails, and is not really what I want anyway.
Is there anything obvious I'm overlooking? For info, I originally had the first two data sets created and running with a fixed connection string before I changed the connection string in the data source to use a dynamic one. I've restarted the report designer since, though, and the first data sets continue to connect using the dynamic string. I tested with multiple databases just to be sure
Never done this before myself but the last 2 sentences in the section Expression-Based connection Strings msdn.microsoft.com/en-us/library/… looks to me like you need to revert to a fixed connection string to do your update then change back to dynamic when ready to publish?

SSIS 2012 Dynamic OLE DB ConnectionString using a parameter

I have a project which I will need to deploy to servers not in our network and thus will not know certain attributes such as the server and database names. So I set up a parameter in the "Project.params" area. In this string parameter I placed: "Data Source=" + #[$Project::ServerName] + ";User ID=" + #[$Project::UserName] + ";Initial Catalog=" + #[$Project::InitialCatalog]; + "Provider=SQLNCLI11.1;Persist Security Info=True;" I copied the connection from the original one I set up before attempting this.
When I set the project level OLEDB Connection manager to this parameter in an expression (for the connection string), I get the string just as I typed and not the values of the other parameters. In other words when evaluated the expression appears just as above. Doing so invalidates all of the components in the package which use the connection. Any ideas on what I am doing wrong? Thank you in advance.
You cannot use multiple Project Parameters in a single parameterized OLE DB connection manager. Also, you cannot create a Project Parameter that dynamically builds on other Project Parameters, as they are read-only within a script task.
You would need to use a local (package-level) connection manager that uses a variable for its connection string. That local variable can be build on project parameter values.
Also see this post for a similar scenario:
Expression Builder of Connection Manager not showing Variables
Your connection string is missing the password field. I faced the same problem and adding the Password field that references to a variable/parameter fixed the problem for me. Also make sure the DelayValidation property is set to "True" for the Connection Manager.

How to Detect Trusted Connection in Crystal Reports using VB.NET?

I have some Crystal Reports connecting to a Sql Server db that I would like to detect whether the connection is trusted or whether I need to supply the log on info (reports are not supplied by me so I can't control the connect method). If I just blindly supply login credentials, it won't connect if it is a trusted connection.
The following does not work:
oRpt = oCR.OpenReport("C:\MyReport.rpt")
if oRpt.Database.Tables(1).ConnectionProperties.Item("Integrated Security") = True then
'trusted connection
else
'supply login credentials
end if
It gives the following error:
Operator '=' is not defined for type 'IConnectionProperty' and type 'Boolean'.
I cannot find how create a construct in vb.net for IConnectionProperty. I can't find any documents from Crystal that explain it.
I am using Crystal Reports XI - Developer
I think i found the answer. By using the property ConnectBufferString
Like this:
Console.WriteLine(oRpt.Database.Tables(1).ConnectBufferString.ToString)
It will give you a string like this
Provider=SQLOLEDB;;Data Source=MYPC\SQLEXPRESS;;Initial Catalog=sample_db;;User ID=;;Password=;;Integrated Security=-1;;Use DSN Default Properties=0;;Locale Identifier=1033;;Connect Timeout=15;;General Timeout=0;;OLE DB Services=-5;;Current Language=;;Initial File Name=;;Use Encryption for Data=0;;Replication server name connect option=;;Tag with column collation when possible=0
You just look for the following:
Integrated Security=-1 = Trusted Connection
Integrated Security=0 = Untrusted Connection
Hope this helps someone else since I wasted a few hours looking.

Classic ASP - SQL Server 2008 Connection String using Windows Authentication

This should be painfully simple, but I cannot come up with a working connection string for a local copy of SQL Server 2008 using Windows Authentication. I've tried using the Data Link Properties tool to create a connection string and it has no problems connecting, but when I copy paste the generated string into my ADODB.Connection object's ConnectionString property I get all sorts of fun and different errors.
Set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString = "SQLNCLI10.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=climb4acure;Data Source=(local);"
Microsoft OLE DB Service Components (0x80040E21)
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
I've tried a variety of similar connection strings but I cannot find one that will work with Windows Authentication. Can someone point me in the right direction?
Thanks!
Here's an easy way to generate connection strings that work.
Right-click an empty spot on the desktop and choose NEW, TEXT DOCUMENT from the context menu
Save it with a .udl extension, and click yes when it asks are you sure.
Double-click the new udl file you just created. It will open a dialogue. Go to the Provider tab, and choose the appropriate provider.
Go to the Connection tab and fill in the server name and database name, and choose NT authentication (or use a specific username and password, which is SQL authentication). Now click Test Connection. If it works, you're ready to click OK and move on to the final step. If it doesn't you need to resolve permission issues, or you've mis-typed something.
Now right-click the file on the desktop and open it in notepad. It will display the connection string that you can copy and paste to wherever you need it.
I assume you have the 2008 Native Client installed? Also, I noticed that you're missing the "provider" tag at the beginning - do you have any more luck with this one:
Provider=SQLNCLI10.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=climb4acure;Data Source=(local);
Have you had a look at connectionstrings.com? They are a pretty good reference (but, in my experience, they don't work too well in the Google Chrome browser).
Works absolutely fine:
"Provider=SQLNCLI;Server=xxxxxxxx;uid=sa;pwd=xxxxxx;database=xxxxxx;"

Using Dynamic Connection Strings in SSRS2008

I have a bunch of SSRS 2008 reports which I'd like to run on several different machines (development, test, production). Each machine has it's own database, so I need to use different connection strings depending on where the report is running.
One workaround I found is to specify the server and catalog name in a hidden parameter that is passed to the report at runtime. It's described in this tutorial, but it applies to SSRS 2005 and I could not make it work in SSRS 2008.
Everything works fine when the connection string in my shared datasource looks like this:
Just so to see if expressions can be used at all for the connection string, I replaced the connection string with this:
But this gives me the following error when I try to preview the report in Visual Studio:
An error occurred during local report
processing. The item
'/Zeiterfassung-Adrian' cannot be
found.
Are dynamic connection strings still working in SSRS 2008?
If yes, what am I doing wrong?
If not, what else can I do?
It's because it's a shared datasource. Should work fine for a regular embedded datasource. Take a look at THIS link for an option on using dynamic connections strings with shared datasources, might be helpful for you.
Just create your report datasource for each environment and deploy them. Then switch your deploy option to not overwrite a datasource. Though to make for simple deployments you will have to configure the configuration manager in bids for each environment. This is how we work in our multiple environments.
Hope it helps, let me know if you have any questions on this.
Please check related article at
http://haseebmukhtar.wordpress.com/2011/11/09/dynamic-database-in-ssrs-2008/
Also you can not use dynamic database settings for the shared data source.
The string should have double double quotes for server name.
="data source="" & Parameters!MyServerParameter.Value & "";initial catalog=DBName.."
I was able to create a dynamic embedded connection using a ServerName parameter as follows:
="data source=" & Parameters!ServerName.Value & ";initial catalog=master"
What about using a hidden report parameter?
then you should be able to do:
="data source=" & Parameters!MyServerParameter.Value & ";initial catalog=DBName.."
Here is an article which should help you out: http://msdn.microsoft.com/en-us/library/ms156450.aspx

Resources