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: 

Beginner's guide to outputting data from Labview to MySQL

Solved!
Go to solution
Hi

I am a student who has only recently started using Labview for a data logging project, so my knowledge of how to use it is rather lacking. My current aim is to be able to output the logged data directly into a MySQL server, so that the data can then be remotely accessed over the internet and processed using PHP scripts.

I have basic knowledge of MySQL, as I have previously used it to create dynamic web pages, but my knowledge of how it works is also somewhat lacking. The MySQL database I would be connecting to is remotely held on a university server that I will connect to.

I have seen that such connection is possible from previous posts, but I would really appreciate a more basic account of the steps that I would need to follow to make such a connection possible.

Thanks,

Rob
0 Kudos
Message 1 of 20
(26,795 Views)
I'm more familiar with Oracle and Access, but the process should be the same. This is assuming you're using the Windows version of LabVIEW:

1) Install mySQL ODBC drivers for Windows
2) Create a DSN using the mySQL ODBC driver and configure it to point to your network based server. (in WinXP: Control Panel->Administrator Tools->Data Sources (ODBC)).
3) Use the N.I. Database Connectivity Toolkit LabVIEW VI's to log your data through standard SQL INSERT statements.

Hope this helps.
0 Kudos
Message 2 of 20
(26,777 Views)
Thanks for your help. Unfortunately, I am a student currently using the Student Edition of LabVIEW, and without the means to purchase the toolset you recommend. I have since found a GPL licensed download at http://performancemicrowave.com/sql_LV.html but I have been unable to get it to work for me, and it doesn't have any documentation.

If anybody has any experience with these libraries, it would be fantastic to hear your ideas.

Thanks,

Rob
0 Kudos
Message 3 of 20
(26,774 Views)


@RobC wrote:
Unfortunately, I am a student currently using the Student Edition of LabVIEW, and without the means to purchase the toolset you recommend.


How about this?

http://forums.lavag.org/index.php?showtopic=2482

Tomi
--
Tomi Maila
Message 4 of 20
(26,764 Views)
Solution
Accepted by topic author RobC
u may 1 2 try this out.. its called LabSQL... its open source so u dun need 2 pay or anything... there r examples inside.. go take a look.... it was recommended 2 me by other users and it worked perfectly 4 me... hope it solves ur prob... Smiley Very Happy
Best Regards,

JQ

LV 8.0 user...
Message 5 of 20
(26,756 Views)
Hi guys

Thanks again for all your help. I've been playing around with LabSQL and have got it to successfully read and write data to a local MS Access database, so I'm pretty chuffed! However, I've not yet been able to connect to a MySQL database. Is there some way of setting up the ODBC in Windows so that it points to a remote MySQL server instead of to a locally held .mdb file?

Cheers,

Rob
0 Kudos
Message 6 of 20
(26,745 Views)
the setting up had been explained by bill above... Control Panel > Administrative Tools > Data Sources (ODBC).. since u've setup an access database, you should noe how 2 continue from here... enjoy.. Smiley Wink
Best Regards,

JQ

LV 8.0 user...
0 Kudos
Message 7 of 20
(26,743 Views)
Thanks. I would be able to connect to a network-based database using that method, but ideally I would like to be able to connect over FTP if that were possible?
0 Kudos
Message 8 of 20
(26,741 Views)
Thank you again for everybody's help with this - it's much appreciated. I have now successfully managed to connect LabVIEW to a remote MySQL database, so job done (sort of)!
0 Kudos
Message 9 of 20
(26,733 Views)

One thing to bare in mind is that you do not HAVE to create a DSN connection in the 'Data Sources (ODBC)' section of the Administrative Tools.

You can actually just wire the appropriate connection string to the 'DB Connect' VI. I do this my self because it allows me to easily install applications without having to manually create a DSN in windows . It also means that if I load the connection string from a file, I can easily change the database to read by just editing the INI file..

 

My connection script is as follows (tested with LabSQL - and the NI connectivity toolkit) ......

DRIVER=MySQL ODBC 3.51 Driver; DB=<Schema Name>; server=<pc name or IP Address>; UID=<username>; PWD=<password>; OPTION=785

Message 10 of 20
(26,592 Views)