This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

How Do I Connect to a Remote Database Without Using a Data Source Name?

Updated Dec 8, 2023

Environment

Software

  • LabVIEW Database Connectivity Toolkit

I need to connect to a database using the LabVIEW Database Connectivity Toolset, but this database is hosted on a remote server, and I must not use a local Data Source Name (DSN) so that my application can be deployed to any computer without manually redefining a DSN. How can I do that ?

To connect to a database, the only alternative to using a DSN is to create and use a Universal Data Link file. This file contains all the information needed by ADO to connect to a database. Please complete the following steps to create your UDL file : 
  • In LabVIEW, go to Tools » Create Data Link. This will launch the 32-bit Data Link Properties dialog that allows you to create your UDL file (even if you are running a 64-bit Windows).
  • Select your database provider.
  • Click Next.
  • Select Use connection string.
  • Insert the appropriate connection string by following the templates found on the connectionstrings website. For example, if the database I want to use is running on a MySQL server with a ODBC connector, I will have to follow this template : 

Driver={MySQL ODBC 5.1 Driver};Server=myServerAddress;Port=3306;Database=myDataBase;
User=myUsername;Password=myPassword;Option=3;
 

  • Fill in the User name and Password, and check the Allow saving password option. The dialog should look like this:
 

Figure 1.
 
  • Click on the Test Connection button to make sure the connection can be established.
  • Click OK. Select the directory where you want to save your UDL file.
You may now start using your database in LabVIEW with the Database API. As the following Figure 2 shows.

Figure 2.