SDAC

Working with Universal Data Link (UDL) Files

A Universal Data Link (UDL) file stores the connection settings for an OLE DB connection to SQL Server. It lets you save and reuse these settings when connecting to the database.

The following sections describe how to create, configure, and use UDL files.

Create the UDL file

  1. In File Explorer, navigate to the folder where you want to place the UDL file.
  2. Right-click in the folder, then select New > Text Document.
  3. Rename the file, replacing the .txt extension with .udl.

Configure the UDL file

  1. In File Explorer, double-click the created UDL file.
  2. In the Data Link Properties dialog, select the provider and configure the connection settings:

Note: The connection settings vary depending on the selected database provider.

Tip: To specify connection properties, use the Advanced and All tabs. For more information about the available properties, see TMSConnectionOptions Properties.

Data Link Properties - Connection Tab

After you configure the UDL file, the connection settings are saved to the file in the following format:

Provider=<database_provider>;Password=<password>;Persist Security Info=False;User ID=<user_name>;Initial Catalog=<database_name>;Data Source=<server_name>;Initial File Name="";Server SPN="";Authentication="";Access Token=""

where:

Establish a connection using the UDL file

You can load connection settings from the UDL file in one of these ways:

The following sections provide practical examples of both approaches.

Specify the UDL file using the property

This code example shows how to load the connection settings at runtime by assigning the UDL file path to the UDLFileName property.

// Triggered when Button1 is clicked	
procedure TForm1.Button1Click(Sender: TObject);
begin
  // Specify the path to the UDL file that contains the connection settings.
  MSConnection1.UDLFileName := '<path_to_udl_file>';

  // Open the connection using the settings from the UDL file.
  MSConnection1.Open;

  // Open the table after the connection is established.
  MSTable1.Open;

  // Display a confirmation message.
  ShowMessage('Ok');
end;

where:

Specify the UDL file in the connection string

This code example shows how to reference the UDL file directly in the connection string.

Tip: To specify the UDL file in the connection string, you can use any of the following parameter names: UDLFileName, UDL File Name, UDL FileName, UDLFile, UDL File, UDL.

// Triggered when Button1 is clicked	
procedure TForm1.Button1Click(Sender: TObject);
begin
  // Specify the connection string that contains the connection settings.
  MSConnection1.ConnectString := 'User ID=<user_name>;Password=<password>;UDLFile=<path_to_udl_file>;';

  // Open the connection using the settings from the UDL file.
  MSConnection1.Open;

  // Open the table after the connection is established.
  MSTable1.Open;

  // Display a confirmation message.
  ShowMessage('Ok');
end;

where:

© 1997-2026 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback