Click here to Skip to main content
14,978,864 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I am currently working on a Arduino based home automation system. I want to send Arduino sensor data to a SQL server, but I do not know how.

All I ask is if anyone who reads this has any suggestions on how I can go about doing this.

What I have tried:

Youtube, Stack OverFlow and Arduino Forums.
Posted
Updated 27-May-21 22:20pm

Quote:
I want to send Arduino sensor data to a SQL server, but I do not know how.

I guess you are a beginner because you do the same mistake as every beginner.
Advice: Learn to break your problems in small/simpler parts.
You don't have a single complicated problem, you have a few simple ones.
you need:
- to learn how to read data sensors, the principle is the same, whatever you do with that data.
- to learn how to connect to SQL server and trow orders, the principle is the same, whatever data come from.
- how to write some glue code to put everything together. Glue code - Wikipedia[^]

If you Google for your exact problem, you will have almost no answer.
But if you Google each simple problems, you will have heaps of answer because those problems are universal.
   
v2
What you most likely need will be a SQL client library for C++. Which one you use is going to depend mostly on what type of DB server you are going to be using.

Once you get that in... you just need to connect to the DB and do what you want
   
As far as I know, there is no library to connect to an SQL Server from Arduino.

You would have to write a WebApi app, run that on a server, and that is your gateway between the SQL Server and the Arduino. The Arduino can make calls to a web api.

Google for "Arduino webapi" for examples.
   
Or you could write a middle layer application from C# to read the nominated serial port
and from arduino you can write to the same serial port and from c# you could connect to your MS SQL
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900