0

I'm about to do this project where I will make some lights flash up depending on some values that are in an SQL database on a server. I have already bought my Arduino and waiting for it to arrive. But I've been stuck at how to read the SQL data from the Arduino, connected to ethernet only.

Is there a library where I can select from the database directly or do I have to make a web service, in which I can make a http request to when needed?

If it's a web service, can I be directed to some examples of this being used with Arduino? I've been looking around the past few days but haven't been able to find a decent example.

Best regards and thanks a lot in advance for your time! :-)

2 Answers 2

1

I would make a small http REST API on your SQL server. The Arduino could use the API to get the data. The API can easily be done in php, ruby or whatever.

0

Connecting to an SQL database from the Arduino would be the hard way. Creating a simple web page that can read data from your database and display said data would be the easier way. You could then access this data on the Arduino via an http request.

Here's an example of how to write such a web page in PHP: https://www.w3schools.com/php/php_mysql_select.asp

And here's the Arduino example for an HTTP request with an ethernet shield: https://www.arduino.cc/en/Tutorial/WebClient

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.