Creating a Microsoft Data Link file (UDL) for Connecting to a Database in LabVIEW

Updated Jun 14, 2018

Reported In

Software

  • LabVIEW
  • LabVIEW Database Connectivity Toolkit

Operating System

  • Windows

Issue Details

The Database Connectivity Toolkit in LabVIEW requires a Microsoft Data Link file (UDL) to interface with a Microsoft Access database. UDL files can also be used to connect with other database types, such as SQL. How do I create a Microsoft Data Link file with a .udl extension in order to do this?

Solution

The way a UDL file is initially created depends on your Windows installation. This can be checked from the Folder shortcut menu.

  1. Right-click on the Desktop or in the folder where you want to create the file.
  2. Select New, then Text Document (or Microsoft Data Link if you have that option)
    1. If Microsoft Data Link was selected, your UDL file is created.
  3. Give the Text Document any name with a .udl extension ("Show file extensions" must be enabled in folder options).
  4. A window will pop up warning that "If you change a filename extension, the file may become unusable. Are you sure you want to change it?" Select Yes.

Additional Information

Once you have a Microsoft Data Link file, you need to link the UDL file to an Access database to use it with your application.
 

  1. Open Access. Select Blank Access Database, and click OK.
  2. In the File New Database window, save the Database in a location of your choice with any .mdb or .accdb extension name.
  3. At this point you can close Access (just remember where you saved the database).
  4. Go back to the UDL file that was created previously and double-click it (this is where a link to the Access database is created).
  5. Click the Provider tab. For .mdb files, select Microsoft Jet 4.0 OLE DB Provider. For .accdb files, select Microsoft Office 12.0 Access Database Engine OLE DB Provider
    NOTE: If you are using a 64 bit Windows operating system, the provider tab will not show the Microsoft Jet 4.0 OLE DB Provider or Microsoft Office 12.0 Access Database Engine OLE DB Provider.  This is because they are 32 bit database providers. To make 32 bit providers display in the Provider tab, follow these steps:
    1. Navigate to Start>>All Programs>>Accessories>>Command Prompt
    2. Type the following command: C:\Windows\syswow64\rundll32.exe "C:\Program Files (x86)\Common Files\System\Ole DB\oledb32.dll", OpenDSLFile C:\test.udl, where C:\test.udl is the file path to the UDL file you have created. This will open the UDL file.
    3. Click the Provider tab, the 32 bit database providers should now show.
  6. Click the Connection tab. Navigate to the .mdb or .accdb Access Database that was created in step 2. Now, the UDL file is ready to be used in LabVIEW.  You can also use a relative path to the UDL file if you will be moving files and don't want to manually edit the UDL file each time you move the files.
 

 


If you see an error that reads Provider cannot be found. Ensure that the provider has been installed properly, you can try opening the file manually and editing its contents to work with your database.
 


    1. Right click on your UDL file and select Open With>>Notepad.
    2. Write the contents of your UDL file without using the Microsoft Data Link Configuration Tool.
    3. You can use the following resource to understand the file syntax. External Link: The Connection Strings Reference.

Here is an example to open a .accdb file without authentication:

[oledb]
; Everything after this line is an OLE DB initstring
Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=C:\Users\Public\Documents\Database.accdb;
Persist Security Info=False;


Where Data Source is the path to the database.

WAS THIS ARTICLE HELPFUL?

Not Helpful