LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to retrieve data from MySQL?

I have read Michael Aivaliotis's pdf document over at lavausergroup.com,
but his only example is for a command.

I want to retrieve data with a simple command like SELECT * from authors.

I have done this sort of thing before with Microsoft Access, and it's worked.
Also, I have read Microsoft's ADO document.

In the attached file, the returned RecordCount should be 7, but it is -1.

Any idea what is wrong?
0 Kudos
Message 1 of 6
(4,471 Views)
Hi nyc,
Try to set recordset's CursorLocation property to UseClient before opening the recordset.
Good luck,
0 Kudos
Message 2 of 6
(4,440 Views)
Xu,

that worked!

thanks. 🙂
0 Kudos
Message 3 of 6
(4,425 Views)
I have created a set of vi's that manipulate text strings to build up the query. I then write the query string to a temp file and run the mysql client in batch mode with the system exec vi. The command looks like this:

cmd /c
mysql -u $user -h $hostname -p$password $database < $tempfile.sql

This way you don't have to deal with the activeX and odbc stuff. ...or you could use the call library function node and use the libMySQL.dll directly.
here's a shot of my query vi
0 Kudos
Message 4 of 6
(4,406 Views)
Hello,

I can't connect to MySQL database from LabVIEW. I have tested your LV_mysql.vi and I have changed the string connection and the query with mine but It doesn't work. I have configured the ODBC drivers from Control Panel.

What's the problem? Can anyone help me?

Thanks,

Toni.
0 Kudos
Message 5 of 6
(4,297 Views)
Hello,

I have solved the problem error provider when I tried to connect MySQL with LabVIEW.

The version of MySQL ODBC 3.51 Driver (MyODBC-3.51.10-2-win.msi, version 3.51.10-2 doesn't work!!!) supplied by MySQL doesn't work with windows XP SP2 and LabVIEW 7.0.

I have downloaded earlier version of MySQL ODBC 3.51 Driver (MyODBC-3.51.10-win.msi, version 3.51.10) and it works very well, no problems.

The link for downloading the correct version is:

http://www.peterharvey.org/MySQL/MyODBC/MyODBC-3.51.10-win.msi

ToNi.
0 Kudos
Message 6 of 6
(4,275 Views)