Send data from FiPy to server
-
Hello Team,
I am trying to send sensor data from FiPy to server. (Ex. i am using my local computer as server with MySQL as DB). Am running below code in atom but getting ImportError No module named MySQLdb.
#!/usr/bin/python
import MySQLdb
#Setting up connection
db = MySQLdb.connect(host=" ", # your host
user=" ", # username
passwd=" ", # password
db=" ") # fill with dredentialscursor = db.cursor()
sql = "INSERT INTO EMPLOYEE(FIRST_NAME,
LAST_NAME, AGE, SEX, INCOME)
VALUES ('%s', '%s', '%d', '%c', '%d' )"try:
cursor.execute(sql)
db.commit() #// SAVE PERMANENTLY
except:
db.rollback() #// IF U GOT ERROR ROLL BACK ALL UR CHANGES
db.close()Please help me with this. How to send data from FiPy to server, if anyone can share code for the same it would be great help.
Waiting for you valuable responses , kindly reply as soon as possible.
Thank You
-
@nazz
You cannot use mysql directly - create some service on your computer and connect your Fipy to it
https://forum.pycom.io/topic/813/mysql -
@livius
Hello,Thank you very much for your quick response, as am new to server and pycom, it would be great help if you could share the code from fipy side and server side with step by step procedure.
Thank You
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login