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: 

LabVIEW and online database

Hello,

I was wondering how to interface LabVIEW with an online database. The database will be or is a part of wordpress.  I hope that makes sense.

 

If anything is unclear, please ask and I will explain more.

 

thanks,

Frank

0 Kudos
Message 1 of 14
(4,847 Views)

What sort of database is it? 

 

You can try the following.  Have never tried it with an online database but it does work on networked dBs.

 

Create a text document on your desktop and rename it to something like connection.udl

Double click the file

Configure the settings and test the connection

Open up the UDL file in a text editor and it will contain the connection string that can be used in the Database Connectivity Toolkit.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 14
(4,824 Views)
If the database primarily exists to support a WordPress installation it would be best to not try to access it directly as it would create a huge security hole. You can create PHP scripts that run on the server and which you call using the HTTP client VIs.

Check here for more info:

http://www.notatamelion.com/2015/06/08/building-a-web-backend-in-labview/

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 14
(4,789 Views)

Wordpress runs on MySQL (only?), for security, many webhosts prevent access to databases from any IP address other than 'localhost' (i.e. the server running the PHP scripts) as Mike is alluding to. If your host allows it and you're willing to accept remote access, then you can use the Database Connectivity Toolkit (or another DB toolkit...I think there's a MySQL one) to connect to the database and get values. The more secure option is to create a RESTful HTTP PHP script which sits on the server and returns the data you want through an API.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 14
(4,772 Views)

Thanks all.  I will try the suggestions and report back.

0 Kudos
Message 5 of 14
(4,738 Views)

Hello Mike,

Your link was informative.

I have a few questions. Where will the php file reside? Does the php file run when the LabVIEW code runs?  Can I run the code without LabVIEW to test if it will work on the server side?

 

thanks,

Frank

0 Kudos
Message 6 of 14
(4,657 Views)

The PHP file sits on the web-server (e.g. where your database lives). It 'runs' every time a HTTP client tries to access it - when you visit http://mysite.com/test.php, it executes the PHP script 'test.php' and returns some data. It is completely separate and has nothing to do with LabVIEW - so you can probably write your API in PHP and test it without using LabVIEW at all.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 7 of 14
(4,637 Views)

Hello Sam,

Thanks for the reply.

Yes, I figure it would sit on the server side. But does it matter what folder on the server side the php file is located?

 

Also, I assume that the "OpenHandle.vi" in LabVIEW would need the username and password as inputs, yes?

 

thanks in advance,

Frank

0 Kudos
Message 8 of 14
(4,605 Views)
The server configuration will tell you where to put the files. You only need an ID and password is they are needed to access the website.

Remember, you aren't talking directly to the database, you are talking to the web server which is providing you with data (that just happens to be in the database).

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 9 of 14
(4,598 Views)

Hello Mike,

Where can I find the server configuration?

 

thanks

Frank

0 Kudos
Message 10 of 14
(4,587 Views)