From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Database query got different results from ODBC and UDL connection

I am getting different results from the ODBC connection and UDL connection.

ODBC1.png   

ODBC2.png

The VI runs the same query, only the connection is different. However, the ODBC connection sucessfully ran the query script and returned the result; UDL connection, did not return anything, no any error message either. 

I tried to google if there is any difference between these two connections, but did not get anywhere. Could it be the query itself? Not likely either, since the ODBC connection does run correctly. 

 

I am so puzzled. What's happening here?

0 Kudos
Message 1 of 3
(2,266 Views)

Hello MengHuiHanTang,

 

From what I can gather, an ODBC uses a Data Source Name (DSN) connection while OLE DB uses a Universal Data Link (UDL) connection. The difference between the two connections are the DSN contains information about a database and the UDL is a universal file that links to a database. For more information check out Difference Between Types of DSN and a UDL.

 

Your UDL file may have been created incorrectly, you can check out Creating a Microsoft Data Link file (UDL) for Connecting to a Database in LabVIEW to review over the process. 

Marina B.
Technical Support Engineer
National Instruments
www.ni.com/support
0 Kudos
Message 2 of 3
(2,217 Views)

Thanks for the reply. 

 

I don't think the UDL file was not correctly set up. If that was the case, I would have seen some type of error now. But I did not. 

 

Following the other link, I tried the 'File DSN' to connect to the database and run the query. It worked. A .dsn file is very similar to a .udl file, and it does not require any configuration in the ODBC window. So I can replace the udl with a dsn now. 

 

Why the udl connection does not work is still a mystery to me though. 

0 Kudos
Message 3 of 3
(2,208 Views)