Go Down

Topic: Receive data from sql database (Read 286 times) previous topic - next topic


Hi, I have an Arduino MEGA and his Ethernet Shield and I'm trying to make a program.

I have a website and a SQL database and I want to 'connect' my Arduino with the sql
I know how to upload data with arduino via php but I also want to receive the data (like a sql GET)

How can I do it? Thanks!


Hello maletils,

I personally not a big fan of having complex/heavy code inside the Arduido, like a TCP/IP stack. I prefer to use simple ways of communication to save resources. But as you're using Mega you might still have some room for other things though...

Anyway, back to your question: to query a DB you can create a simple HTTP API on your PC/Server. You can do it using PHP as you mentioned if you're familiar with the language.

You just need to receive the query, a GET request from the Arduino with a few parameters and "translate" into the query to the DB. After you send the results back using a pre-formatted output, a format easy to read and parse in the Arduino according to your needs.

Don't try to connect your Arduino directly to the DB, the protocol implementation will be very hard.

Does it make sense for you?

Mike M.

Go Up