Creating and Configuring Universal Data Link (.udl) Files
The Microsoft Data Access Components (MDAC) provide the Data Link Properties dialog box as the common user interface for specifying connection information to a data provider on Windows 2000 and later operating systems. You can use the Data Link Properties dialog box to save connection information in a universal data link (.udl) file.
To create a Universal Data Link (.udl) file
- Open Windows Explorer.
- Select the folder in which you want to store the .udl file.
- If you are running Windows 2000 or later, select New on the File menu, and choose Text Document. A new file named New Text Document.txt appears in the directory. Rename this file, removing all spaces and changing its file extension to .udl.
Note A warning that changing file extensions can cause files to become unusable might appear. Disregard it.
If you are running Windows 98 and Windows NT systems with Microsoft Data Access Components (MDAC) installed, right-click the right pane, or results pane, select New, and choose Microsoft Data Link. A new file named New Microsoft Data Link.udl appears in the directory. You can rename this file.
To configure a universal data link (.udl) file
- Double-click the universal data link (.udl) file.
The Data Link Properties dialog box opens, displaying the following tabs: Provider, Connection, Advanced, and All. Choose Next to navigate from tab to tab.
- On the Provider tab, select a database provider.
- On the Connection tab, either select the data source name (DSN) of an available Provider, or enter a custom connection string. Valid DSNs for providers that are pre-defined on your system are displayed in the Use Data Source drop-down list.
- Use the Advanced tab to view and set other initialization properties for your data.
- Use the All tab to review and edit all OLE DB initialization properties available for your OLE DB provider.
- Choose OK to save the connection string to the Universal Data Link (.udl) file.
For more information, see Data Link Properties Dialog Box.
Data Link File Format
The first two lines of a universal data link (.udl) file must have exactly this content:
[oledb] ; Everything after this line is an OLE DB initstring
After these required lines, the remainder of the .udl file consists of a connection string written in the same format used when opening a database from programming code. The following listing gives the complete text of a .udl file that uses the OLE DB provider for Microsoft SQL Server to open the Northwind database using integrated security.
[oledb] ; Everything after this line is an OLE DB initstring Provider=SQLOLEDB.1;Persist Security Info=False;Data Source=a-iresmi2000;Initial Catalog=Northwind;Integrated Security=SSPI
Configuring Data Controls to Use Universal Data Link (.udl) Files | Information on Data Link Properties and OLE DB Providers | Connection String Syntax | Connecting to Remote Resources with Server Explorer | Databases in Server Explorer | Displaying Data Sources in Server Explorer | Adding New Data Connections in Server Explorer | Adding Items from Server Explorer | Data Access Technologies