DataLink

Description

Specifies that you want to create a file or use an existing file containing your connection information to connect to your data source.

When to specify DataLink

You must specify the DataLink parameter before connecting to the database.

Applies to

ADO.NET

OLE DB

SNC SQL Native Client for Microsoft SQL Server

MSOLEDBSQL Microsoft OLE DB Driver for SQL Server

Syntax

DataLink='file_name'

Default value

None

Usage

The Data Link option allows you to access Microsoft's Data Link API. The Data Link API allows you to define a file or use an existing file that contains your connection information. A Data Link file is identified with the suffix .udl.

To launch the API, double-click on Manage Data Links under OLE DB Utilities in the Installed Database Interfaces list or select the File Name check box on the Connection page in the Database Profile Setup dialog box and click the button next to the File Name box.

For more information on using the Data Link API, see Microsoft's Universal Data Access website.

Using a Data Link file versus setting other database parameters

If you use a Data Link file to connect to your data source with the ADO.NET or OLE DB interface, all other settings you make in the Database Profile Setup dialog box are ignored.

If you use a Data Link file to connect to your data source with the SNC interface, the setting in the ProviderString database parameter still takes effect. The SNC interface gets a connection string from the data link file, and then copies the contents of the ProviderString parameter into the connection string so that it contains the connection parameters from both the data link file and the ProviderString parameter. You might want to take advantage of this feature if you do not want to save the user name and password in the UDL file. You can specify them in the ProviderString parameter instead.

Examples

To use the file oledb.udl to connect to an OLE DB data provider:

  • Database profile

    Select the File Name check box on the Connection page in the Database Profile Setup dialog box and enter a name for a new file or select an existing file.

  • Application

    Type the following in code:

    SQLCA.DBParm="DataLink='oledb.udl'"