Installation and Configuration Supplement

Adding OLE DB data sources to a Federated System

To access OLE DB data sources using OLE DB table functions:

  1. Install and configure OLE DB 2.0 or higher and OLE DB provider for data source. Follow the software requirements from your OLE DB provider.
  2. Use the CREATE WRAPPER statement to define the wrapper library that will be used to access OLE DB providers.

    Wrappers are the mechanism that federated servers use to communicate with and retrieve data from data sources. The following example shows a CREATE WRAPPER statement:

    CREATE WRAPPER OLEDB
    
    where OLEDB is the default name of the wrapper module used with OLE DB providers. You can substitute the default name with a name that you choose; however, if you do so, you also must include the LIBRARY parameter and the name of the wrapper library for your federated server platform. See the SQL Reference, Volume 2 for more information about wrapper library names.
  3. Use the CREATE SERVER statement to define a server name for an OLE DB data source. For example:
    CREATE SERVER Nwind 
    WRAPPER OLEDB 
    OPTIONS (
    CONNECTSTRING 'Provider=Microsoft.Jet.OLEDB.4.0; 
       Data Source=c:\msdasdk\bin\oledb\nwind.mdb',
    COLLATING_SEQUENCE 'Y');
    
    where:
  4. If a user ID or password at the federated server is different from a user ID or password at an OLE DB data source, use the CREATE USER MAPPING statement to map the local user ID to the user ID and password defined at the OLE DB data source; for example:
    CREATE USER MAPPING FOR john
    SERVER Nwind
    OPTIONS (REMOTE_AUTHID 'dave', REMOTE_PASSWORD 'mypwd');
    
    where:
  5. You can use the server name Nwind to identify the OLE DB provider by using the CREATE FUNCTION statement:
    CREATE FUNCTION orders ()
    RETURNS TABLE (orderid INTEGER, ...)
    LANGUAGE OLEDB
    EXTERNAL NAME 'Nwind!orders';
    


[ Top of Page | Previous Page | Next Page ]