LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

database connection via UDL file

Solved!
Go to solution
Highlighted

I successfully developed a LabVIEW 2018 SP1 (32-bit) application (.EXE) to connect to a database using a UDL file. The file was created via Data Link in LabVIEW 2018 SP1 (32-bit).

 

This EXE file is then distributed to non-LabVIEW PC operators who are only required to install LabVIEW 2018 SP1 Run-Time Engine.

 

However, the application (EXE) failed to connect to the database. How do I fix this problem for these non-LabVIEW PC's ?

 

Here is the content of the UDL file:

 

[oledb]
; Everything after this line is an OLE DB initstring
Provider=MSOLEDBSQL.1;Password=Td@c$123_;Persist Security Info=True;User ID=svc_bh_setupuser;Initial Catalog=TDACS;Data Source=TXBDSTLGPRP01;Initial File Name="";Trust Server Certificate=True;Server SPN="";Authentication="";Access Token=""

 

0 Kudos
Message 1 of 10
(325 Views)
Highlighted

The UDL file tells the application to use the MSOLEDBSQL driver but is that driver installed on the user PC?  If you double-click the UDL file, are you able to successfully test the connection to your database? 


aputman
LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 2 of 10
(310 Views)
Highlighted

Dear aputman,

 

If I double-click the UDL file, and test the connection, it is successful {see attachment}.

 

Thanks for reminding me of checking the "Microsoft OLE DB Driver for SQL Server (MSOLEDBSQL)" driver.

 

If the PC user does NOT have it, do I download the driver from Microsoft ?

 

0 Kudos
Message 3 of 10
(296 Views)
Highlighted

If the test succeeds, this means the driver is already installed.

What error are you receiving in the LabVIEW program?  


aputman
LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 4 of 10
(292 Views)
Highlighted

Hello aputman,

 

Sorry, the UDL successful connection was tested from my laptop.

 

I tested the UDL from one of the PC users, and I got an error in Microsoft Data Link {see attachment}. Does this mean the MSOLEDBSQL driver is not installed ?

 

0 Kudos
Message 5 of 10
(281 Views)
Highlighted

Correct.  You can find it at this website:

 

https://docs.microsoft.com/en-us/sql/connect/oledb/oledb-driver-for-sql-server?view=sql-server-ver15


aputman
LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 6 of 10
(274 Views)
Highlighted

Read notes 1, 2 and 3 in the article.  It talks about two providers that have been deprecated, one of them being the one you have specified in your connection string (SQLOLEDB).  You'll want to change this to MSOLEDBSQL after installing the driver.  


aputman
LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 7 of 10
(266 Views)
Highlighted

Thanks, aputman,

 

"Provider=MSOLEDBSQL" is the only string in my UDL file, so I don't worry about conversion.

 

Your Website link contains identical 32- and 64-bit drivers.

 

My LabVIEW 2018 SP1 is 32-bit running on my 64-bit laptop, and the database server I am told is 64-bit. I guess I will just install the 64-bit driver for my 64-bit PC users.

 

Will let you know how my application (EXE) works on those PC's.

 

0 Kudos
Message 8 of 10
(257 Views)
Highlighted

Thanks for your help, aputman,

 

After installing the 64-bit MSOLEDBSQL driver on one of the PC users, I tested the UDL connection, and it was successful.

 

My application (EXE) works!

 

0 Kudos
Message 9 of 10
(242 Views)
Highlighted
Solution
Accepted by topic author cha@bellflight.com

Great.  I'm glad you were able to get this solved. 

Please mark one of the replies as the solution so others know that this question is solved.  Kudos are also appreciated.  


aputman
LabVIEW 2017
LabVIEW Programming
Message 10 of 10
(237 Views)