Using Dynamic Connection Strings in SSRS2008 - connection-string

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

Related

Connect to a Postgresql database using power query in Excel

I am struggling with the above - I've installed PowerQuery (64 bit Excel 2013 setup) and under the database connection options, despite following the instructions here to download the Ngpsql data provider for PostgreSQL:
https://support.office.com/en-ie/article/Connect-to-a-PostgreSQL-database-Power-Query-bf941e52-066f-4911-a41f-2493c39e69e4?ui=en-US&rs=en-IE&ad=IE
I can still only see a limited set of options under under the database list, which do not include a PostgreSQL database. Now having hunted around on the web I found this thread:
https://superuser.com/questions/950100/connect-to-postgresql-database-from-excel-2013-power-query-with-npgsql
Which seems to suggest that the reason I cannot see the Postgresql option is that I am not using an OfficePro installation (think it was home edition).
Does anyone have any pointers - any workaround for this? Or do I really have to get a different version of office to get data from a Postgresql db, short of converting the database into Access or something? Thanks
[I have Office 2013 Pro.]
I had to do this in addition to installing "PowerQuery_2.44.4675.281 (64-bit) [en-us].msi" (I ticked GAC installation on the installation dialog) and "Npgsql-3.2.3.msi". Also, rebooted the machine.
Everything then started to work connection-wise.
But when returning large amounts of data into Excel with Powerquery at times I would get "type cast" errors - I could not map it down to NULLs or anything easy to determine. Powerquery seems a fine tool for some usages and I am sure this error can be fixed with data transformation steps.
If you just want to get the postgres data - you can use VBA + ADO. I have just finished setting it up and it works.
Install "psqlodbc_x64.msi".
Add references to your vba project.
Finally I created the connection with this connecton string (no windows DSN setup required - modify the string below as per your setup):
cnn.Open "Driver={PostgreSQL Unicode(x64)};Server=127.0.0.1;Port=xxxx;UID=postgres;PWD=postgres; Database=db_name;"
I could also successfully add it as a data source using the same connection string.

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?

Dynamic datasource in SSRS

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.

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.

Connection String for Oracle in OraDb11g_home1 Driver

I know that connection string questions are a dime-a-dozen, but I've got a new one.
I created a System DSN to talk to an Oracle database that I have locally on my machine. I put in all the info and hit the test button, and it says that it's successful. I'm using the OraDb11g_home1 driver.
When I try to put together a connection string for an application that uses ODBC, of course I can't get it to work.
One of the connection string attributes that they say that they require in their documentation is something called "Provider." What is this?
One of the most recent strings that I've used includes the following.
Driver={Oracle in OraDb11g_home1};Server=\\localhost:1521\local;Uid=mike;Pwd=password
Can anyone please offer any suggestions? Thanks,
mj
I figured it out. I was trying to use an application that was using 32-bit ODBC and the DSNs that I created were 64-bit.

Resources