ChuckBell / MySQL_Connector_Arduino

Database connector library for using MySQL with your Arduino projects.
331 stars 132 forks source link

insert into database crashes after first iteration #102

Closed palo207 closed 5 years ago

palo207 commented 5 years ago

Hi, I am having an issue with ESP8266 while doing insert into the database in a loop, the same code runs well if I use select command and is able to run for hours but the insert crashes on second iteration of the cycle with error code :

ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset

I googled the code and it seems to be triggered by watchdog. I do not have an idea what may cause the error, since the code runs well as long as the command is select instead of insert my code is below:

void loop() {

//Select from database if (conn.connect(server_addr, 3306, user, password)){ delay(500); sprintf(query, INSERT_SQL, sensorid , workplaceid , farba, R, G, B ); delay(50); MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn); delay(1);

cur_mem->execute(query); delay(1000); Serial.print("zapisal som do db"); Serial.println();

cur_mem->close(); delete cur_mem; conn.close(); delay(500); } else{ conn.close(); delay(500); } }