LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -2147467259 When Attempting to Open Connection to Database

I have LabVIEW 2014 (32-bit) installed on a 64-bit Win7 machine and I get the following error when I try to open a connection to a database.  A coworker with the exact same setup does not get this error.

NI_Database_API.lvlib:DB Tools Open Connec (String).vi->Untitled 2<ERR>ADO Error: 0x80004005
Exception occured in Microsoft OLE DB Provider for SQL Server: Invalid connection string attribute in NI_Database_API.lvlib:DB Tools Open Connec (String).vi->Untitled 2

Here is the simple test VI we are using:

TestVI.jpg

0 Kudos
Message 1 of 11
(8,062 Views)

Mklusman,

 

 Thanks for providing system information and replicating the system. Just a few questions to narrow things down:

 

1. Has this VI ever worked with your computer?

2. Does your collegue have the same database and file path setup that the VI is accessing?

3. From the VI, it seems like you're trying to connect to a SQL database. Would it be possible to try with Microsoft Access or another database system?

4. I'd also take a look at this post. The issue seems to be a string connection that's having trouble handshaking between the two APIs. This post has similar issues.

 

Hope those questions help or at least give some good next steps!

Regards,

Ali S.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 11
(8,010 Views)

 

1. Yes, this worked on my machine some time ago.  I couldn't pinpoint when it broke though.

2. My co-worker has basically the exact same setup that I do.  We spent an afternoon comparing all the settings we could find without success.  This connection comes from some legacy tools that we support.  These tools are widely distributed around the company so we have a lot of history that this connection string works on most machines.

3. I'm still trying to get to the database.  It is an SQL database on a server.  I'm not able to see it by accessing the server.  However, I have found that I can make the connection a couple of different ways.  If I turn on the prompt for the VI and set it as follows the code snippet above will work.  This also led me to change the connection string and set the Provider=SQL Native Client.  The code will then work as well without the prompt.  One thing that I notice is that the list of providers in the prompt does not appear to include the "SQLOLEDB" that the hard-coded string uses.  Could this indicate the problem?

4. Looking at that post (and others) it seems they all use a UDL or file DSN or some other method.  Unfortunately since this is such a widely used application here I don't have the option of changing the connection method or the code.

Snap1.jpg

0 Kudos
Message 3 of 11
(7,996 Views)

Follow-up on item 1: I have verified that I can connect to and read the database using SQL Server Mangment Studio 2014.

0 Kudos
Message 4 of 11
(7,989 Views)

Interesting, did you connect to the same database using SQL Server Mangment Studio 2014 using the same VI with the original settings. Additionally, can you connect to a local database or does it give the same error?

Regards,

Ali S.
Applications Engineering
National Instruments
0 Kudos
Message 5 of 11
(7,983 Views)

I'm not sure what you mean connecting to the database using the same VI with SQL Server Management Studio.  I'm not very familiar with SQL Server Management Studio.  I was basically able to connect to the database in it and then open one of the tables to view it.

0 Kudos
Message 6 of 11
(7,977 Views)

Hi mklusman,

 


3. I'm still trying to get to the database.  It is an SQL database on a server.  I'm not able to see it by accessing the server.  However, I have found that I can make the connection a couple of different ways.  If I turn on the prompt for the VI and set it as follows the code snippet above will work.  This also led me to change the connection string and set the Provider=SQL Native Client.  The code will then work as well without the prompt.  One thing that I notice is that the list of providers in the prompt does not appear to include the "SQLOLEDB" that the hard-coded string uses.  Could this indicate the problem?

It's interesting that you aren't able to see one that seems to correspond to the SQL provider in the prompt - is there one called "Microsoft OLE DB Provider for SQL Provider"?

 

When you launch the prompt by setting it to True, it actually launches the Microsoft Data Link application. According to the help file associated with the program, the Providers window does the following: 

 

Lists all OLE DB providers detected on your computer. For more information about providers, see Microsoft OLE DB Providers Overview on MSDN.

 

Use the Provider tab to select the appropriate OLE DB provider for the type of data you want to access. Not all applications allow you to specify a provider or modify the current selection; this tab is displayed only if your application allows the OLE DB provider selection to be edited. You can save a data link with the application itself or as a separate file.

 It may be that there is an issue with the database providers on your computer, since it doesn't seem to be detected. Maybe try reinstalling the Microsoft Data Access Components, and see if it appears in the list afterward.

 

Regards,

 

Regards,

Michael Whitten
Senior RF Applications Engineer
0 Kudos
Message 7 of 11
(7,955 Views)

Yes, I do the the Microsoft OLD DB Provider for SQL Server in the list from the VI prompt (see attached).

 

I tried reinstalling the drivers from the link provided and it has no effect in anything that I can find.  The VI still will not work and the list of providers in the prompt didn't change.

0 Kudos
Message 8 of 11
(7,941 Views)

Have you tried to select the Microsoft OLE DB Proviuder for ODBC drivers? 

I have only used the Database Toolkit with a ODBC driver for connecting to a Microsoft SQL server. 

0 Kudos
Message 9 of 11
(7,929 Views)

You mean in the connection string for the VI?  It doesn't fix the problem but it does change the error message slightly.  When I use "Microsoft OLE DB Provider for ODBC Drivers" as the provider in the string I get the following error messsage:

NI_Database_API.lvlib: DB Tools Open Connec (String).vi->Database Connectivity Test.vi<ERR>ADO Error: 0x80004005
Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. in NI_Database_API.lvlib: DB Tools Open Connec (String).vi->Database Connectivity Test.vi

0 Kudos
Message 10 of 11
(7,917 Views)