Hi
I recently raspberry pi on new SD card and installed mysql and commented bind address in /etc/mysql/my.cnf
so remote arduino can connect to it, this part work, but now I am getting error
Inserting : INSERT INTO arduinoSensorData.sensorLog (out_temperature, out_humidity, drwngRoom_temperature, drwngRoom_humidity, pot1_soilMoisture, pot1_avg_SoilMoisture, millieVolt, uv_index, wateringPot1) VALUES ('24.60', '27.40', '29.80', '22.20', '64', '64', '0.00', '0', 'N/A');
Error: 155 = You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1.
Connection Successfull,inserting to database.
Error: 33 = Got packets out of order.
and code used to insert mysql query you see above in first line is:
String getSqlInsertString()
{
// inserting to sql database on mysql server
insertSql = "";
insertSql.concat("INSERT INTO arduinoSensorData.sensorLog (out_temperature, out_humidity, ");
insertSql.concat(" drwngRoom_temperature, drwngRoom_humidity, pot1_soilMoisture, pot1_avg_SoilMoisture, ");
insertSql.concat("millieVolt, uv_index, wateringPot1) VALUES ('");
insertSql.concat(outdoorTempInC);
insertSql.concat("', '");
insertSql.concat(outoorHumidity);
insertSql.concat("', '");
insertSql.concat(indorTempinC);
insertSql.concat("', '");
insertSql.concat(indoorHumidity);
insertSql.concat("', '");
insertSql.concat(val);
insertSql.concat("', '");
insertSql.concat(avgVal);
insertSql.concat("', '");
insertSql.concat(Vsig);
insertSql.concat("', '");
insertSql.concat(uvIndex);
insertSql.concat("', 'disbaled");
insertSql.concat("');");
if (sqlEnDis == 1) {
if (!connected) {
Serial.println("Establishing Connection");
my_conn.mysql_connect(server_addr, 3306, user, password);
connected = true;
}
else if (connected == true)
{
// my_conn.cmd_query("use arduinoSensorData;");
// Serial.print("total Rows: ");
// Serial.println(my_conn.cmd_query("select count(*) from sensorLog;"));
insertSql = getSqlInsertString();
const char *mycharp = insertSql.c_str();
my_conn.cmd_query("use arduinoSensorData;");
Serial.print("Inserting : ");
Serial.println(insertSql);
my_conn.cmd_query(mycharp);
Serial.println("Connection Successfull,inserting to database.");
sqlInsertInterval = 10000; // set the repeat interval to a minute after first insertion.
} else
{
// TODO : log to sd card when server is not reachable.
Serial.println("Connection failed.");
}
on earlier set up of mysql on previous raspberry pi it was working. but now it doesnt. gets the error and mega get stuck