Go Down

Topic: Arduino + mysql database + control acess (Read 23541 times) previous topic - next topic

PaulS

Quote
I have the arduino sending a GET to the PHP

Can you post this code?

Quote
The PHP checks that value against the database

And this code?

Typically, when a GET request is made, the client expects an HTML page back. But, the server could send a text file or jpg file or zip file or an xml file instead.

PHP is capable of returning an HTML-based page, as well as simple text.

The Arduino then needs to check for some data coming back from the server, and extract the relevant data from the file.

I've done quite a bit with PHP (not recently, but I still remember a little) and MySQL, so it shouldn't be hard at all to make PHP reply with the appropriate information.

bubulindo

Hello,

I'm having a similar problem.

I also want to keep values logged in my house in a remote DB, so far mySQL is the choice (free). I haven't yet tried to use the arduino with ethernet shield to run a php script on a server. I used it as a server and it worked fine so it should be fairly simple (to be tested next month) to run a php script in a remote server.

My problem here is that I want to cut the "middle man", I already have an Ethernet shield, so why add a computer in the way? If I'm going to use the computer I might as well get an old computer with a serial or parallel port and do the entire thing there.

So my question is, can the Arduino connect to a remote mySQL DB and add the data directly to it? What would be involved?
This... is a hobby.

PaulS

Quote
So my question is, can the Arduino connect to a remote mySQL DB and add the data directly to it? What would be involved?

The Arduino can connect to a remote server, and run a script on that server.

If the server is also running MySQL, and the script has embedded SQL commands in it (like a PHP script could easily have), then the script that is executed could store data in the database on the remote server.

But, no the Arduino can not connect directly to a database. It doesn't speak the language.

zoomkat

Quote
My problem here is that I want to cut the "middle man", I already have an Ethernet shield, so why add a computer in the way?


If you know how to run a computer database program without the computer, then you are a very clever person.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

bubulindo

"Cut the middle man" as in the computer between the arduino and the server...

I still don't know of ethereal DBs, but when I do, you'll be the first to know.
This... is a hobby.

robtillaart

Quote
can the Arduino connect to a remote mySQL DB and add the data directly to it?


IIRC An MySQL server has a socket open TCP port 3306 and the login needs encryption to access it. This encryption is quite heavy and my initial thought was it is way too big for the Arduino.

So I stopped and installed - http://www.apachefriends.org/en/xampp.html and used php as middleman (xampp includes mySQL)

my 2 cnts
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

bubulindo

I got a reply from another forum with this link:

http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol#Organization
It may become useful for someone else.

From what I see, it is possible. I haven't looked at the encryption definition, but implementing all this is too much for 30k... if you want some relevant space left for the running software. I do believe that creating the code just to insert code might be feasible well within the program memory limit.

The other thing I need to check are the timeouts between server-client... after all, this is an 8 bit 16 Mhz machine. LOL
This... is a hobby.

Go Up