Step 1: Connect to the AdventureWorks2000 Database

This topic explains how to define the XML for the LobSystem and LobSystemInstance objects to connect to the AdventureWorks2000 database. For simplicity, the sample XML provided in this topic uses PassThrough authentication. For a more complex sample using single sign-on (SSO), see Step 7 (Optional): Use Single Sign-On to Connect to the AdventureWorks2000 Database.

The LobSystem object is the top-level container for metadata that describes a particular business application. In XML terms, it is the root node that contains all other metadata objects. The LobSystemInstance object under the LobSystem object provides authentication and connection string information to the Business Data Catalog.

The Business Data Catalog supports the following database authentication modes:

  • PassThrough

  • RevertToSelf

  • RdbCredentials

  • WindowsCredentials

For more information, see Business Data Catalog Authentication.

Prerequisites

Before you write metadata, you must set up your environment. This example assumes you have Microsoft Office SharePoint Server 2007 already set up and that you have installed the AdventureWorks2000 sample database.

The default installation of Microsoft SQL Server 2000 does not include the AdventureWorks2000 database. Download the AdventureWorks2000 sample database from the Microsoft Download Center. You should install the AdventureWorks2000 database on the same computer on which Office SharePoint Server 2007 is installed.

To connect to the AdventureWorks2000 database

  1. Create a text file and save it as AdventureWorks2000.XML. Location of the file does not matter.

  2. Open the text file for editing in your text editor.

  3. Insert the following XML:

    Xml
    <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
    <!-- This metadata XML defines three entities: Product, Customer, 
    and SalesOrder from the AdventureWorks 2000 Sample database.-->
    <LobSystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://schemas.microsoft.com/office/2006/03/BusinessDataCatalog BDCMetadata.xsd" Type="Database" 
    Version="1.0.0.0" Name="AdventureWorksSample" 
    xmlns="http://schemas.microsoft.com/office/2006/03/BusinessDataCatalog">
      <Properties>
        <Property Name="WildcardCharacter" Type="System.String">%</Property>
      </Properties>
      <LobSystemInstances>
        <LobSystemInstance Name="AdventureWorksSampleInstance">
          <Properties>
            <Property Name="AuthenticationMode" 
    Type="System.String">PassThrough</Property>
            <!--AuthenticationMode can be set to PassThrough, 
            RevertToSelf, RdbCredentials, or WindowsCredentials. -->
            <Property Name="DatabaseAccessProvider" 
    Type="System.String">SqlServer</Property>
            <!-- Can be SqlServer, OleDb, Oracle, or Odbc for database 
            systems. -->
            <Property Name="RdbConnection Data Source" Type="System.String">EnterYourAdventureWorks2000ServerNameHere</Property>
            <!-- The name of your server hosting the AdventureWorks2000 
                 database or the name of the SQL Server instance in the 
                 format SQLServer\Instance. -->
            <Property Name="RdbConnection Initial Catalog" 
    Type="System.String">AdventureWorks2000</Property>
            <!-- The name of the database.> -->
            <Property Name="RdbConnection Integrated Security" 
    Type="System.String">SSPI</Property>
            <Property Name="RdbConnection Pooling" 
    Type="System.String">false</Property>
          </Properties>
        </LobSystemInstance>
      </LobSystemInstances>
      <Entities>
        <!-- Enter your Entity XML here -->
      </Entities>
    </LobSystem>
  4. In the LobSystemInstance metadata, replace the name of the SQL Server that hosts the AdventureWorks2000 database in the RdbConnection Data Source property accordingly. If you use a SQL Server instance, use the format SQLServer\Instance.

  5. Save the XML file.

Next Steps

Step 2: Define Entities, Methods, and Filters.

See Also

Other Resources

Business Data Catalog: Metadata Model
AdventureWorks SQL Server 2000 Sample

Tags :


Community Content

Paul Galvin
Functional example that shows how to embed a sql user id and password in the ADF

I wrote this entry (http://paulgalvin.spaces.live.com/blog/cns!1CC1EDB3DAA9B8AA!320.entry) that shows a functioning example where we specify the user id and password of a SQL account to use (as opposed to the example provided above).

--Paul Galvin

Tags : sharepoint bdc

Paul Galvin
Avoid manually encoding sql commands by using CDATA

Wrap the RdbCommandText inside a CDATA to avoid manually encoding the query.

For example:

            <Property Name="RdbCommandText" Type="System.String">
<![CDATA[
SELECT dbo.MCRS_SETTLEMENT.id, dbo.MCRS_SETTLEMENT.settlement from dbo.MCRS_SETTLEMENT
WHERE (id >= @MinId) AND (id <= @MaxId)
]]>
</Property>

If you don't use CDATA then you need to translate the ">" into "&gt;" and the "<" symbol into "&lt;".


Tags : bdc

Page view tracker