From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MySQL Connection Error

Solved!
Go to solution

Hope this one is simple.  I am trying to connect to a MySQL database running on a local machine.  This is the following software used:

 

Windows 7 Home Premium 64-bit

mysql-5.5.20-winx64

mysql-connector-odbc-5.1.9-winx64

mysql-workbench-gpl-5.2.37-win32

Labview 2011 with Database Connectivity Toolkit

 

I created a simple database and table to test out my initial connection and learning.  I read thru the following document, and did what it said:

 

http://digital.ni.com/public.nsf/allkb/47A8CF66D5E3C8CC8625720A006139D6

 

However, when I wire this together, and ask it to give me a list of the tables available, it gives me the following error:

 

Error -2147467259 occurred at NI_Database_API.lvlib: DB Tools Open Connec (String).vi ->NI_Database_API.lvlib: DB Tools Open Connec (Path).vi ->Untitled 1

Possible reason(s):
ADO Error: 0x80004005
Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application in NI_Database_API.lvlib: DB Tools Open Connec (String).vi->NI_Database_API.lvlib: DB Tools Open Connec (Path).vi->Untitled 1

 

I have included a screenshot of the code with the error message.  The questions becomes, what do I need to do to fix it, and how do I have it point to the User DSN I created?  It looks like you can create a File DSN, but that doesn't seem to get many anywhere either.  I am confussed how I would wire the User DSN to the open connection vi so I don't have to have the prompt always come up.  When I 'test connection' from the User DSN config window from the Admin Tools in Control Panel, I connects without issue, so it would appear to be that tring to make the connection from Labview is the problem.  I do have a user ID and password, and I saved them in the User DSN config, do I really need to re-enter them at the Labview level?  I guess the thing that jumps out me here is that it says it has a mismatch, I am trying to use the latest driver (5.1), and the example above is using MySQL ODBC 3.51.  Does this cause a problem with the 'Microsoft OLE DB Provider for ODBC Drivers'?

 

 

0 Kudos
Message 1 of 10
(9,764 Views)

I have a LabVIEW 5.1 VI where I connect to a MySQL database.

I don't use the Database Connectivity Toolkit.

I basically used the ActiveX Open and ActiveX Invoke and converted http://dev.mysql.com/doc/refman/5.6/en/connector-odbc-examples-programming.html to LabVIEW.

 

The pop-up you are talking seems to generate the DSN connection string every single time you run the VI.

 

 

0 Kudos
Message 2 of 10
(9,753 Views)

So, I found a different thread talking about connections problems, and it referred to this knowledge base article:

 

http://digital.ni.com/public.nsf/allkb/E7984C0DA0F0E65086257694005B4CB7

 

So my issue might be 64 vs 32 bit ODBC driver.  I know that installed the 64 bit driver.  I will download and install the 32 bit tomorrow.  I did forget to mention that I am using a 32 bit version of Labview.  It does beg the question do I need to use the 32 bit version of MySQL as well, or is the driver able to talk to a 64 bit database server?   Basically everything needs to be 32 bit?

 

I can't wait until this 32/64 bit issue is far in the rear-view mirror...

 

0 Kudos
Message 3 of 10
(9,747 Views)

You should give yourself credit and mark this thread solved.  Smiley Happy

0 Kudos
Message 4 of 10
(9,732 Views)
Solution
Accepted by topic author biographie

Yeah, this issue is solved, definitly have to use all 32-bit pieces if you are using 32-bit labview (seems obvious, but with the new single installer they have at MySQL for Windows it trys to act smart and install whichever type matches your OS).

 

One little note, to configure a DSN file using the 32-bit driver, you have to use the 'C:\Windows\SysWOW64odbcad32.exe' because the normal one you run from Admin Tools does not list the 32-bit version of the MySQL ODBC driver.  At this point, I could point to the file, and get everything running without issue both locally and remotely.

Message 5 of 10
(9,715 Views)

I have been looking at your post, and when I tried to perform the fix you have supplied, I cannot find the sysWOW64 folder on the Win 7 machine.

 

I also, tried creating an .udl on the Win 7 machine and it wont open the .udl, gave me an error on trying to open the .dll that edits the .udl.

0 Kudos
Message 6 of 10
(9,358 Views)

Let me ask the simple question first.  Are you running a 64-bit version of Windows?  When I open the windows folder, I see the sysWOW64 listed right under the system32 folder.  The next step (which I am slightly unsure of) did you already install all the 32-bit pieces needed for MySQL?  I am looking currently at a cleanly installed Windows 7 (no MySQL), and I don't see the sysWOW64odbc.exe that I listed.  So I assume that executable must be installed when you perform the MySQL install.  That is probably a poor assumption on my part.

 

0 Kudos
Message 7 of 10
(9,350 Views)

THAT very well be what I need to do is install the 32 bit of mySQL!!  That is my fault, the way I read your posts I assumed that the WOW64 was already there.  Ok, I will look at getting that installed and going from there, Thanks!

0 Kudos
Message 8 of 10
(9,332 Views)

Biographie, you saved my day.

0 Kudos
Message 9 of 10
(8,386 Views)

GREAT!!!!!!!!!!!!

 

I WAS GOING TO KILL  EVERYONE.
THANKS, EVERY THING WORKS GREAT NOW!!!

 

0 Kudos
Message 10 of 10
(7,851 Views)