LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Database connection errors

Solved!
Go to solution

While trying to connect to the SQL Server 2012 with the "Database connection.vi" I am facing two problems. 

 

With the assistant when selecting the connection method 'Prombt' and then 'MS OLE DB Provider for SQL Server', the test is succesful but when exit it with 'ok' afterwards, this error occurs:

2020-08-25 13_03_43-LabVIEW Help.png

 

when using it with a string directly (ODBC method), another error occurs:

2020-08-25 14_34_42-SQL Server 2012 connection strings - ConnectionStrings.com.png

connection string from: https://www.connectionstrings.com/sql-server-2012/

 

thanks in advance for any help

 

 

 

 

0 Kudos
Message 1 of 5
(1,821 Views)

Hi,

in my experience this is happen when you run 64 bit assistent and 32 bit labview version or viceversa.

Maybe assistent and LabVIEW are running both on same bitness but you have to be sure.

 

All the best

Golzione

0 Kudos
Message 2 of 5
(1,815 Views)

Hi Golzioge

 

Thank you for the fast reply.

Indeed, this could be a problem. We are running LV 32 Bit. 

What to do in the second example where no assistant is active - as far as I understand it?

 

all the best, Mischl

0 Kudos
Message 3 of 5
(1,808 Views)
Solution
Accepted by topic author mischl

Hi!

 

There is still some kind of driver involved.

 

I'm connecting to MS SQL server 12 via

Provider=SQLOLEDB.1;

SQLOLEDB may be the 64Bit driver and SQLOLEDB.1 the 32Bit driver. I don't know.

To get this connection string, create an empty text file and call it x.udl. You can double-click it, but you will get the 64Bit editor.

Use this to get the 32Bit editor when you plan to use this on LabVIEW 32Bit:

C:\Windows\syswow64\rundll32.exe "C:\Program Files (x86)\Common Files\System\Ole DB\oledb32.dll", OpenDSLFile D:\x.udl

 

With that GUI, you should be able to setup and test the connection to the server. Once done, you can copy the string out of the file - or wire the path to the file to the DB connect VI.

 

Message 4 of 5
(1,770 Views)

Hi Seb

 

Thank you a lot for the explanation and therefore the clarification.

 

Provider=SQLOLEDB.1;

 Did the trick with 'ODBC System DSN'!

 

have a good time

Message 5 of 5
(1,738 Views)