LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -2147467259 w/ DB Tools Open Connect while using .exe

I am using LabVIEW 2015 (32-bit) and I am having an issue connecting to a SQL database while running the executable. The program works fine while in the development environment but once it's built the .exe won't connect. I'm connecting through the DB Tools Open connection default vi and feeding it a connection string from a config file.

 

Any help would be appreciated.

0 Kudos
Message 1 of 17
(3,201 Views)

I assume you are on Win64.

Use the ODBC tool found in c:\Windows\sysWOW64\odbcad32.exe.

 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 17
(3,193 Views)

Also what does your connection string look like?  Are you sure that you're reading the connection string properly from the config file?  Do you have the proper path to the config?  Most often, when reading from a file works in DevEnv but not in EXE, there is an issue with the path. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 17
(3,188 Views)

To remove that possibility, I have just hardcoded the connection string in the mean time.

0 Kudos
Message 4 of 17
(3,162 Views)

This is the error that keeps showing up.

0 Kudos
Message 5 of 17
(3,161 Views)

Did you try using the ODBC tool in the sysWOW64 directory to configure the connection?  Either the connection string is wrong or you are using the wrong ODBC tool.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 6 of 17
(3,156 Views)

The connection string is correct as I can access the database in the development environment and the string does not change. I'm not quite sure how to use the ODBC tool, and IT is not quite sure how it needs to be configured. Can you clarify on that?

0 Kudos
Message 7 of 17
(3,108 Views)

What is your connection string?

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 8 of 17
(3,102 Views)

Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Test_Database;Data Source=SQLTEST

0 Kudos
Message 9 of 17
(3,096 Views)

I've also tried a UDL which didn't change the outcome either.

0 Kudos
Message 10 of 17
(3,095 Views)

Well, UDL is just a text file that has a connection string saved in it.  Open a UDL file with a text editor and you'll see the same as the connection string.  

 

Your datasource is SQLTEST.  Is that the name of your SQL instance?  Is the server running on localhost or on a server?  Add the server location to the data source.  Data source = servername\instance

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 11 of 17
(786 Views)

The database is running on a server. Again the string should be correct as I can connect to the database through the development environment with no issue. If I change the string it no longer connects in even the development environment.

0 Kudos
Message 12 of 17
(781 Views)

I understand that it works in DEV but doesn't work in EXE.  You have stated that multiple times but that doesn't make sense to me unless DEV and EXE are two different machines.  So for now, I am ignoring that statement and trying to be as thorough as possible.  And I would advise the same on your end.

 

Create a .txt file on your desktop and rename it with a .UDL extension.  Double click the UDL file and configure the settings to connect to the server.  You should be able to test the connection and confirm everything right from that dialog box.  After you get a successful connection, close the dialog and open the UDL file with a text editor and use the string found there as you connection string.  What happens?

 

Have you tried rebooting your PC? 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 13 of 17
(768 Views)

I followed your steps and setup the .udl and the test connection was successful. The connection string it ended up giving me was the same as what I had. I ran the exe (hoping for a miracle) and it gave me this error.

 

I'm confused on how it cannot exist/denied me when I just connected to it. I rebooted yesterday but I will try again and let you know the results.

0 Kudos
Message 14 of 17
(763 Views)

Since you are using Integrated Security, there may be some other detail that I am missing or not familiar with.  

 

Here are a couple of other suggestions to try:

 

Use the SQL Server Native Client provider?

Make sure you have the most up to date ODBC drivers for the SQL version that you're using.

Try to setup a User DSN in the ODBC tool that I mentioned early on.  After you get a successful connection there and have saved it, configure the UDL file and select Microsoft OLEDB Provider for ODBC Drivers.   

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 15 of 17
(757 Views)

After playing around with the location of the .exe it turned out to be a firewall issue with the network drive I was running the executable from. When I previously asked IT they had no idea there was something in place to prevent this from happening.

0 Kudos
Message 16 of 17
(740 Views)

Thanks APutman for all the help!

0 Kudos
Message 17 of 17
(739 Views)