LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data source name not found and no default driver specified in Database Error Code -2147467259

Hey people,

 

I'm having issues when trying to use the DB Tools open connection.vi in order to write data to a SQL data table. In my VI I have two different states that handle different data based on a specific test specified to run, but both are inserted into the same SQL table. I get the unspecified error "NI_Database_API.lvlib:DB Tools Open Connec (String).vi->Main.vi<ERR>ADO Error: 0x80004005
Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified in NI_Database_API.lvlib:DB Tools Open Connec (String).vi->Main.vi"

when running one test but not the other...since the error is unspecified I'm having a hard time finding any information that might help me.

0 Kudos
Message 1 of 6
(4,754 Views)

Code please.

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 6
(4,741 Views)

here are screen shots of the two states that use the DB tools vi. Cannot post the whole code due to proprietary reasons. Capture1 shows the compile data state, which is the state that works. Capture shows the compile data_bend state which has the db tools that doesnt work.

Download All
0 Kudos
Message 3 of 6
(4,733 Views)

When you say that the compile data state works, do you mean that you get no error or that data is actually being written to the database?  You are passing the errors over and over thru the loop without handling or clearing the errors, it appears.  It's hard to say without seeing more code.  

 

One thing to check is to make sure there are no spaces in the DSN.  A simple way to find out is to right click on the string and Codes Display, looking for a '\s' at the end of the 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 4 of 6
(4,692 Views)

When I say it works, I mean that it gets no errors and writes the data to the SQL Table. The Connection name and table name are correct as written.

0 Kudos
Message 5 of 6
(4,665 Views)

Did you check to see if you are clearing any errors before trying to write data?  Is there a reason that you wire the error in on the Open Connection VI?  Leave it disconnected unless you know for a fact that you are handling any errors before this SQL code executes.  

Capture.PNG

If you look at the block diagram of the Open Connection VI, the first thing it checks for is an error on the input.  If so, no connection code is executed.  

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 6
(4,637 Views)