I have raspberry pi 3 that gets me data from sensors by using Python. I want to send that data to a windows pc and precisely to the SQL server. I knew that the best choice I have is to use the httprequest method or get/post. Any help concerning the code of the service?
Asked
Active
Viewed 163 times
1 Answers
0
You can use direct queries from your python application gathering data to send it to your SQL Server - it doesn't matter if the SQL Server is running on Widows or Linux. If you want to send it via HTTP Request, you will need to write second application - API to process the request and save data to SQL Server. In that case see the link below.
Connecting python 3.3 to microsoft sql server 2008
Connecting to Microsoft SQL server using Python
import pyodbc
db = pyodbc.connect("Driver={SQL Server Native Client 13.0};"
"Server=server_name;"
"Database=db_name;"
"Trusted_Connection=yes;"
"uid=username;"
"pwd=password";)
cursor = db.cursor()
cursor.execute('some SQL query')

alinous
- 61
- 4
-
I am using Python 3 in the RPi 3 and SQL server 17 – MHD BKT Jul 24 '17 at 17:09
-
pymysql is just for MYsql – MHD BKT Jul 24 '17 at 17:19
-
@MHDBKT I am aware of that - it was just an example, as I wrote it. – alinous Jul 25 '17 at 07:10