The following table shows the ways that a linked server can be set up for data sources that can be accessed through OLE DB. A linked server can be set up more than one way for a particular data source; there can be more than one row for a data source type. This table also shows the sp_addlinkedserver parameter values to be used for setting up the linked server.
|
Remote OLE DB data source
|
OLE DB provider
|
product_name
|
provider_name
|
data_source
|
location
|
provider_string
|
catalog
|
|---|
|
SQL Server
|
Microsoft SQL Server Native Client OLE DB Provider
|
SQL Server
1 (default)
|
|
|
|
|
|
|
SQL Server
|
Microsoft SQL Server Native Client OLE DB Provider
|
|
SQLNCLI
|
Network name of SQL Server (for default instance)
|
|
|
Database name (optional)
|
|
SQL Server
|
Microsoft SQL Server Native Client OLE DB Provider
|
|
SQLNCLI
|
servername\instancename (for specific instance)
|
|
|
Database name (optional)
|
|
Oracle
|
Microsoft OLE DB Provider for Oracle
|
Any2
|
MSDAORA
|
SQL*Net alias for Oracle database
|
|
|
|
|
Oracle, version 8 and later
|
Oracle Provider for OLE DB
|
Any
|
OraOLEDB.Oracle
|
Alias for the Oracle database
|
|
|
|
|
Access/Jet
|
Microsoft OLE DB Provider for Jet
|
Any
|
Microsoft.Jet.OLEDB.4.0
|
Full path of Jet database file
|
|
|
|
|
ODBC data source
|
Microsoft OLE DB Provider for ODBC
|
Any
|
MSDASQL
|
System DSN of ODBC data source
|
|
|
|
|
ODBC data source
|
Microsoft OLE DB Provider for ODBC
|
Any
|
MSDASQL
|
|
|
ODBC connection string
|
|
|
File system
|
Microsoft OLE DB Provider for Indexing Service
|
Any
|
MSIDXS
|
Indexing Service catalog name
|
|
|
|
|
Microsoft Excel Spreadsheet
|
Microsoft OLE DB Provider for Jet
|
Any
|
Microsoft.Jet.OLEDB.4.0
|
Full path of Excel file
|
|
Excel 5.0
|
|
|
IBM DB2 Database
|
Microsoft OLE DB Provider for DB2
|
Any
|
DB2OLEDB
|
|
|
See Microsoft OLE DB Provider for DB2 documentation.
|
Catalog name of DB2 database
|
1 This way of setting up a linked server forces the name of the linked server to be the same as the network name of the remote instance of SQL Server. Use data_source to specify the server.
2 "Any" indicates that the product name can be anything.
The Microsoft SQL Server Native Client OLE DB provider is the provider that is used with SQL Server if no provider name is specified or if SQL Server is specified as the product name. Even if you specify the older provider name, SQLOLEDB, it will be changed to SQLNCLI when persisted to the catalog.
The data_source, location, provider_string, and catalog parameters identify the database or databases the linked server points to. If any one of these parameters is NULL, the corresponding OLE DB initialization property is not set.
In a clustered environment, when you specify file names to point to OLE DB data sources, use the universal naming convention name (UNC) or a shared drive to specify the location.
sp_addlinkedserver cannot be executed within a user-defined transaction.
Security Note: |
|---|
When a linked server is created by using sp_addlinkedserver, a default self-mapping is added for all local logins. For non-SQL Server providers, SQL Server Authenticated logins may be able to gain access to the provider under the SQL Server service account. Administrators should consider using sp_droplinkedsrvlogin <linkedserver_name>, NULL to remove the global mapping.
|