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 dredentials

    cursor = 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



  • @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



  • @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



Pycom on Twitter