Home‎ > ‎Misc‎ > ‎

Arduino SQL connection fix (kinda)

posted Nov 6, 2017, 2:39 AM by Jose Marie Maquinay
Been delving with Arduino + SQL connection using Chuck Bell's wonderful SQL connector library HERE.

It works, but not perfect. One of the issues that plagued many users is that it crashes the arduino after doing multiple SQL queries due to the Arduino's very limited memory space. After scouring the net and several experimentations, have found the conn.close(); command.

Normally, the SQL connector is like this :

MySQL_Connection conn((Client *)&client);

and close it using the conn.close(); command.

It adds several seconds to the code, but will enable you to have more than one query. Just remember to close the connection after each query. You can check my github for examples.

The SQL connector works well with SQL BUT it takes too long for my project, so later changed to PHP/SQL GET combo which is much, much faster than the Arduino SQL connector...