Connecting to a Data Source (Report Builder 2.0)

In Report Builder 2.0, you can include a data source in your report in two ways:

  • Browse to and include a reference to a shared data source on the report server. The connection information that is needed to retrieve report data is stored on the report server.

  • Create an embedded data source that is used only by your report. You must provide connection information and specify the credentials to use.

For more information, see Working with Embedded and Shared Data Sources (Report Builder 2.0) and Specifying Credentials for a Report Data Source (Report Builder 2.0).

A data source definition specifies the data source type, the connection string, and credentials. Data source definitions can be shared for use by multiple reports or embedded in the report definition. You can create a new data source definition or use an existing shared data source. To connect to a data source, you must have the following information:

  • Data source type   The specific type of data source, for example, Microsoft SQL Server. Choose this value from the list of supported data source types:

    • Microsoft SQL Server

    • Microsoft SQL Server Analysis Services

    • OLE DB

    • Oracle

    • ODBC

    • SAP NetWeaver BI

    • Hyperion Essbase

    • Teradata

    • XML


      You can also use a report model as a data source. Because you can browse to and select a report model directly from a report server, the Report Server Model data source type that is available in other authoring environments is not included in Report Builder 2.0.

  • Connection information   Also known as the connection string, connection information includes the name and location of the data source, and sometimes a specific version of the data provider. If the data source is a database, you can specify the name of the database in the connection string. For embedded data sources, you can also write expression-based connection strings that are evaluated at run time. For more information, see Example Connections (Report Builder 2.0).

  • Permissions   You must have been granted the appropriate permissions to access both the data source and the specific data on the data source, using the credentials you specify. For example, to connect to the AdventureWorks2008 sample database installed on a network server, you must have permission to connect to the server and also read-only permission to access the database.


    Credentials that you use to preview your report on a local system may differ from credentials you need to view your published report. For more information, see Specifying Credentials for a Report Data Source (Report Builder 2.0).

After you have connected to a data source, the data source definition appears in the Report Data pane. The Report Data pane displays embedded data sources and references to shared data sources.

For more information, see:

Expression-based connection strings are evaluated at run time. Expression based strings work only if you are connected to a report server.

For example, you can specify the data source as a parameter, include the parameter reference in the connection string, and allow the user to choose a data source for the report. For example, suppose a multinational firm has data servers in several countries. With an expression-based connection string, a user who is running a sales report can select a data source for a particular country before running the report.

The following example illustrates the use of a data source expression in a SQL Server connection string. The example assumes you have created a report parameter named ServerName:

="data source=" & Parameters!ServerName.Value & ";initial catalog=AdventureWorks

Data source expressions are processed at run time or when a report is previewed. The expression must be written in Visual Basic. Use the following guidelines when defining a data source expression:

  • Design the report using a static connection string. A static connection string refers to a connection string that is not set through an expression (for example, when you follow the steps for creating a report-specific or shared data source, you are defining a static connection string). Using a static connection string allows you to connect to the data source so that you can get the query results you need to create the report.

  • When defining the data source connection, do not use a shared data source. You cannot use a data source expression in a shared data source. You must define an embedded data source for the report.

  • Specify credentials separately from the connection string. You can use stored credentials, prompted credentials, or integrated security.

  • Add a report parameter to specify a data source. For parameter values, you can either provide a static list of available values (in this case, the available values should be data sources you can use with the report) or define a query that retrieves a list of data sources at run time.

  • Be sure that the list of data sources shares the same database schema. All report design begins with schema information. If there is a mismatch between the schema used to define the report and the actual schema used by the report at run time, the report might not run.

  • Before publishing the report, replace the static connection string with an expression. Wait until you are finished designing the report before you replace the static connection string with an expression. Once you use an expression, you cannot execute the query in Report Builder 2.0. Furthermore, the field list in the Report Data pane and the Parameters list will not update automatically.

If you configure your ODBC or SQL data source to prompt for a password or to include the password in the connection string, and a user enters the password with special characters like punctuation marks, some underlying data source drivers cannot validate the special characters. When you process the report, the message "Not a valid password" may indicate this problem. If changing the password is impractical, you can work with your database administrator to store the appropriate credentials on the server as part of a system ODBC data source name (DSN). For more information, see "OdbcConnection.ConnectionString" in the .NET Framework SDK documentation.


It is recommended that you not add login information such as passwords to the connection string. Report Builder 2.0 provides a separate tab on the Data Source dialog box that you can use to enter credentials. These credentials are stored securely on the Report Builder 2.0 computer.

Community Additions