2014년 10월 6일 월요일

[LabVIEW] Creating and Configuring MSSQL UDL Files and Implementing a code in LabVIEW


In this article, I will explain the way that interworks LabVIEW and MSSQL.

To connect the Database, We need to create or have a UDL file. UDL is a Universion Data Link which defines how to access the specific data source such as MSSQL, MySQL, and so on.

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.

1) Creating and Configuring UDL file

1-1) To create a udl file, you have to select the folder in which you want to store the udl file and create a txt file in Windows.

1-2) Rename this file, removing all spaces and changing its file extesion to udl.

1-3) 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.


1-4) In Provider tab, For MSSQL server, select Microsoft OLE DB Provider for SQL Server. 

1-5) In Connection tab, enter the information about server name, login information, and database which is made in server.

1-6) Click Test Connection and confirm the result. If your setting is correct, you can see the below picture. 


2) The implementation to use a database in LabVIEW

We need to use a Database Connectivity Toolkit for an efficient database programming in LabVIEW. The information of this toolkit is as follows:


Let's look at the part of the programming. 

You can find the functions for a Database Connectivity Toolkit in Functions - Connectivity - Database. These functions are to use easily. These functions are made intuitively. Therefore you can use these functions(subVIs) easily.

This code is that

1) Connect the server through a udl file

2) Run sql command as "Select UserName, UserAge from UserTbl"

3) Get the result from MSSQL server and show it to an data indicator

4) Remove rows if condition is true

5) Run sql command as "Select UserName, UserAge from UserTbl"

6) Get the result from MSSQL server and show it to an data 2 indicator

7) you can compare the result

In this article, I explained the way to create and configure a udl fine and the usage in LabVIEW.

댓글 없음:

댓글 쓰기