Federated Search SQL Server Connector Sample

By using the Federated Search Connector sample, you can learn how to create a connector that can return federated search results from a Microsoft SQL Server database.

The MSS2008Samples.exe download file includes the complete code for the Federated Search Connector sample application. To download MSS2008Samples.exe, see Federated Search Connector Sample.

This sample shows how to:

  1. Implement a basic federated connector.

  2. Query an instance of a SQL Server database that is running on the local server and return the results to Search Server 2008 in RSS format.

  3. Provide search results HTML for a More Results link.

  4. Create a location for the federated search connector by using the Search Server 2008 Administration site.

  5. Test the sample by configuring an instance of the Federated Search Results Web Part to use the location for the federated search connector.


To use the Federated Search Connector sample, you must have the following installed in your development environment:

  • Microsoft Search Server 2008

  • SQL Server 2005 on the same server with Microsoft Search Server 2008

  • Microsoft Visual Studio 2005 with Microsoft Visual C# or Microsoft Visual Basic enabled

  • Federated Search Connector Sample download.

Setting Up the AdventureWorksDW Database

Obtain the AdventureWorksDW database and install it on the server running SQL Server. You can find the AdventureWorksDW database in the following location:

Download the AdventureWorksBI MSI installer.


The SQL Server sample databases are designed by default to use SQL Server 2008. If you have SQL Server 2005 installed, you must select SQL Server 2005 SP2a from the Releases list before downloading the sample databases, or the installation will fail. For more information about installing the sample databases, see the Microsoft SQL Server Community & Samples FAQ.

Deploying the Web Application

To deploy the sample Web application, copy the FederatedConnectorSample folder and contents from the path Local_Drive:\\2008 Search Server Developer Resources\ to the _layouts virtual directory, located in the path Local_Drive:\\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS.

Verifying that Data Connectivity is Working

To verify that you have data connectivity, browse to the path http://localhost/_layouts/FederatedConnectorSample/SearchResellers.aspx.

You should see a page with an RSS feed that shows several results from the DimResellers table in the AdventureWorksDW database.


You need to change the server name that is specified in this URL to match the Web server you are using.

Creating a Federated Location

After you verify that you have data connectivity in the sample application, you can create a federated location for the connector.

To create the federated location

  1. On the Search Server 2008 Administration page, click Federated Locations, and then click New Location.

  2. In the Location Name and Display Name fields, type AdvWorksResellers.

  3. In the Description field, type text to describe the location, such as Search DimResellers table in the AdventureWorksDW database.

  4. In the Version field, type 1.0.

  5. For the Location type field, click OpenSearch 1.0/1.1.

  6. In the Query Template field, type http://localhost/_layouts/searchresellers.aspx?q={searchTerms}.

  7. In the "More Results" Link Template field, type http://localhost/_layouts/searchresellers.aspx?q={searchTerms}&f=htm.

  8. In Specify Credentials, select the appropriate authentication protocol. For example, you could select Corporate: NTLM - Specify a username and password, and then type the credentials for an account that has access to the AdventureWorksDW database.

  9. Click OK.

To configure the Federated Search Web Part

  1. From the main Search Center site, go to the Search Results page in the path http://YourServerName/results.aspx.

  2. Click Site Actions, and then click Edit Page.

  3. Click Edit for the Federated Results[2] Web Part, and then click Modify Shared Web Part.

  4. In Location Properties, click AdvWorksResellers on the Location list, and then click OK.

  5. Click Site Actions, and then click Exit Edit Mode to close the Edit page.

To test the federated search connector

  1. Go to the Search Center Home page in the path http://YourServerName/default.aspx.

  2. Type a search term in the search box that will return results from the DimResellers table, for example, type bike.

    If the Federated Connector is working, you should see search results from the AdventureWorksDW database on the search results page.

See also

Federated Search Connector Sample Code
Architecture Guidance for Building Federated Search Connectors