Dynamic Connection Strings in Reporting Services 2005

  • yes you can , but all teh sqls in data set shluld be stored procs. then u can pass username and password as a parameters to the report.

    --------------------------------

  • I found your article interesting and a great solution. I am testing it out and receive this error and cannot seem to implement a work-around.

    An error has occurred during report processing.

    Cannot create a connection to data source 'master'.

    An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

    Do you have any idea what is causing this error? I already checked the remote connectios and we do allow them against the test servers.

  • Hey Crunchy...what did you do to get the database names into a dropdown? That is the only part that I am trying to make work.

  • Anyone got it working with multiple values of parameter? I get this error:

    "Error during processing of the ConnectString expression of datasource ‘xxx’."

    conn string: ="Data Source=servername;Initial Catalog="+Parameters!CountryName.Value

    For single value its working fine but foe multiple values its not working.

    Any hint would be greatly appreciated!

    Ankur

  • ankurk2 (11/23/2011)


    Anyone got it working with multiple values of parameter? I get this error:

    "Error during processing of the ConnectString expression of datasource ‘xxx’."

    conn string: ="Data Source=206.17.24.23;Initial Catalog="+Parameters!CountryName.Value

    For single value its working fine but foe multiple values its not working.

    Any hint would be greatly appreciated!

    Ankur

    Ankur,

    you may use the following string for creating conneciton string

    ="Data Source=" & Parameters!ServerName.Value & ";Initial Catalog=" & Parameters!DBName.Value

    we use Windows Authentication to connect , so the first parameter is for servername and second for databasename

    this works.

    Jeswanth

    --------------------------------

  • HI Jeswanth,

    Thanks for the reply!! Sorry to say but your method won't work. You are just making server name dynamic.

    My question was can we select multiple values for parameter with that connection string.

    As it is single connection string and it can take only one database at a time. And in your given string it can take only one server name and related database name.

    I hope you understand now. Some1 has any idea about selecting multiple values for parameter. Please let me know.

    Thanks

  • First things first. If you want to use Server Names in the drop down list then make a dataset which would populate your server names. and then create another dataset with servername as parameter and populate database names. Now your Stored Procedure should be written using execute sql command

    SP_executesql N'servername+databasename+storedproc'

    so now you will get the dropdown list populated which inturn would execute your stored proc on different servers.

    remember if you have a query instead of SP then you need to have dynamic sql statements prepared.

    let me know if you have any more questions

  • I am trying to statically set the Server and choose which database that I want to pull the reports from. Is that possible? And if so, is it possible to choose which db's that I want to use and restrict the list to those?

  • I have few questions:

    1. Are all databases in one server?

    2. Do you want to select one database at a time or multiple?

    Thanks

  • Hi Grasshopper,

    All db's are on one server and I am only looking to access one of them at a time.

  • ok.

    step 1: create one simple report for one database and run it.(check whatever you want is there or not)

    step 2: then create one parameter 'SelectDatabase'. now go to parameter properties-> available values-> specify values->;(add your databases name here[how many you want])

    step 3: go to datasource properties and paste this ="Data Source=ServerName;Initial Catalog="+Parameters!SelectDatabase.Value

    Step4: Save and Run your report . Now you have to select database. Select it and run report.

    Let me know if you have some problem.

    Thanks

  • Microsoft's solution to this problem is the introduction of "Expression-based Connection Strings" (see this article for reference) which unfortunately does not apply to shared data sources.

    Fortunately, by using a tool, some report design standards, and a Report Definition Customization Extension (RDCE), it is possible to change the Data Source References on the RDL file to point to the right Server-Database pair.

    You can check this article:

    Dynamically Pointing to Shared Data Sources on SQL Reporting Services using a Report Definition Customization Extension (RDCE)

Viewing 12 posts - 61 through 71 (of 71 total)

You must be logged in to reply to this topic. Login to reply