ChuckBell / MySQL_Connector_Arduino

Database connector library for using MySQL with your Arduino projects.
332 stars 133 forks source link

ESP8266 Reboot on connection #171

Open Glammies opened 3 years ago

Glammies commented 3 years ago

Hi I'm using this library since last two years and work fine until today. Normally i use this library in some devices at home. I have all my home automation based in MariaDB since last two year without any problem. Now am trying to make some changes on my code and after upload the code to esp8266 the reboots begin. So back to the original example of this library(only change the user/pass of wireless and database) and the problem persist.

he reboot happen on the line below. I only test this with nodemcu.

if (conn.connect(server_addr, 3306, user, password))

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

load 0x4010f000, len 3460, room 16 tail 4 chksum 0xcc load 0x3fff20b8, len 40, room 4 tail 4 chksum 0xc9 csum 0xc9 v00044b90 ~ld

Connecting to Glammies........... Connected to network My IP address is: 192.168.1.76 Connecting to SQL... ...trying...

Uded code:

include // Use this for WiFi instead of Ethernet.h

include

include

IPAddress server_addr(192,168,1,219); // IP of the MySQL server here char user[] = ""; // MySQL user login username char password[] = ""; // MySQL user login password

// Sample query char INSERT_SQL[] = "INSERT INTO test_arduino.hello_arduino (message) VALUES ('Hello, Arduino!')";

// WiFi card example char ssid[] = ""; // your SSID char pass[] = ""; // your SSID Password

WiFiClient client; // Use this for WiFi instead of EthernetClient MySQL_Connection conn(&client); MySQL_Cursor* cursor;

void setup() { Serial.begin(115200); while (!Serial); // wait for serial port to connect. Needed for Leonardo only

// Begin WiFi section Serial.printf("\nConnecting to %s", ssid); WiFi.begin(ssid, pass); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }

// print out info about the connection: Serial.println("\nConnected to network"); Serial.print("My IP address is: "); Serial.println(WiFi.localIP());

Serial.print("Connecting to SQL... "); if (conn.connect(server_addr, 3306, user, password)) Serial.println("OK."); else Serial.println("FAILED.");

// create MySQL cursor object cursor = new MySQL_Cursor(&conn); }

void loop() { // if (conn.connected()) // cursor->execute(INSERT_SQL); // // delay(5000); }

ChuckBell commented 3 years ago

Hello. First, you should determine what has changed to suddenly cause this failure. Identifying what changed is the best path forward. Was it an upgrade to your system, database, hardware, etc.? Identify the change(s) and revert them to the point where the problem is resolved.

Also, please understand that the connector was written for Oracle MySQL. Any other variant is not guaranteed to work. Some do, most don't. I would suggest if the database system was changed or upgraded, you try Oracle's MySQL to see if the problem goes away. If you must use a non-Oracle release, I will try to help, but I may not be able to completely solve any incompatibilities.

All that said, reboots typically happen due to memory problems or errors in the script (often related to memory too). If you cannot determine what changed or if you confirm nothing has changed, I would suggest you may have a hardware issue, but I suspect you will find something that has changed - an OS update, DB update, etc.

Finally, I would also suggest using a different board as a test - like an Arduino Uno or similar that is known to work well with the connector.

renandamaia commented 3 years ago

I am also having the same problem with ESP8266, after updating the board to version 3.0 in the Arduino IDE, ESP is no longer able to establish a connection with MySQL.

woeperbe commented 3 years ago

Same problem here !

Greetings, Marc Buffet

On 28 May 2021, at 22:28, Renan da Maia @.***> wrote:



I am also having the same problem with ESP8266, after updating the board to version 3.0 in the Arduino IDE, ESP is no longer able to establish a connection with MySQL.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/ChuckBell/MySQL_Connector_Arduino/issues/171#issuecomment-850653914, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKXOBGPI56SRWUK6655GIDLTP74DLANCNFSM45MDIOAQ.

ChuckBell commented 3 years ago

Ok, I will see if I can duplicate the problem. Which ESP module(s) are you using?

On May 28, 2021, at 4:35 PM, Marc Buffet @.***> wrote:

Same problem here !

Greetings, Marc Buffet

On 28 May 2021, at 22:28, Renan da Maia @.***> wrote:



I am also having the same problem with ESP8266, after updating the board to version 3.0 in the Arduino IDE, ESP is no longer able to establish a connection with MySQL.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/ChuckBell/MySQL_Connector_Arduino/issues/171#issuecomment-850653914, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKXOBGPI56SRWUK6655GIDLTP74DLANCNFSM45MDIOAQ. — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/171#issuecomment-850656957, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYCXWD5PEPZPNHDQ4LLTP747LANCNFSM45MDIOAQ.

renandamaia commented 3 years ago

ESP8266 (LOLIN WeMos) D1 R1; Board version By ESP8266 Community version 3.0.0; Lib MySQL Connector 1.2.0;

MySQL: Server version: 5.5.25-log - MySQL Community Server (GPL) Protocol version: 10

woeperbe commented 3 years ago

I’am using Nodemcu V3

Greetings, Marc Buffet

On 29 May 2021, at 01:14, Dr. Charles Bell @.***> wrote:



Ok, I will see if I can duplicate the problem. Which ESP module(s) are you using?

On May 28, 2021, at 4:35 PM, Marc Buffet @.***> wrote:

Same problem here !

Greetings, Marc Buffet

On 28 May 2021, at 22:28, Renan da Maia @.***> wrote:



I am also having the same problem with ESP8266, after updating the board to version 3.0 in the Arduino IDE, ESP is no longer able to establish a connection with MySQL.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/ChuckBell/MySQL_Connector_Arduino/issues/171#issuecomment-850653914, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKXOBGPI56SRWUK6655GIDLTP74DLANCNFSM45MDIOAQ. — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/171#issuecomment-850656957, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYCXWD5PEPZPNHDQ4LLTP747LANCNFSM45MDIOAQ.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/ChuckBell/MySQL_Connector_Arduino/issues/171#issuecomment-850715836, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKXOBGMCS4R5HZ6SCW3LQBDTQAPT3ANCNFSM45MDIOAQ.

ChuckBell commented 3 years ago

Ok, all my ESP boards are older. I’ve ordered new boards to test the issue. Will post my results next week.

On May 29, 2021, at 2:01 AM, Marc Buffet @.***> wrote:

I’am using Nodemcu V3

Greetings, Marc Buffet

On 29 May 2021, at 01:14, Dr. Charles Bell @.***> wrote:



Ok, I will see if I can duplicate the problem. Which ESP module(s) are you using?

On May 28, 2021, at 4:35 PM, Marc Buffet @.***> wrote:

Same problem here !

Greetings, Marc Buffet

On 28 May 2021, at 22:28, Renan da Maia @.***> wrote:



I am also having the same problem with ESP8266, after updating the board to version 3.0 in the Arduino IDE, ESP is no longer able to establish a connection with MySQL.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/ChuckBell/MySQL_Connector_Arduino/issues/171#issuecomment-850653914, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKXOBGPI56SRWUK6655GIDLTP74DLANCNFSM45MDIOAQ. — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/171#issuecomment-850656957, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYCXWD5PEPZPNHDQ4LLTP747LANCNFSM45MDIOAQ.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/ChuckBell/MySQL_Connector_Arduino/issues/171#issuecomment-850715836, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKXOBGMCS4R5HZ6SCW3LQBDTQAPT3ANCNFSM45MDIOAQ. — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/171#issuecomment-850777154, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYE7NWJPXLXIDPXADKLTQB7MPANCNFSM45MDIOAQ.

woeperbe commented 3 years ago

I have a lot exceptions 9 due to misalignment errors. I think to stay away from ESP8266 3.0.0 until other versions are available.

ChuckBell commented 3 years ago

I have confirmed this is a bug in the ESP8266 v3.0 hardware code. You can revert to 2.7.4 and it will work again. Just uninstall the 3.0.0 and install the 2.7.4.

Glammies commented 3 years ago

Thanks for your help :)

ChinaBurn commented 3 years ago

I have confirmed this is a bug in the ESP8266 v3.0 hardware code. You can revert to 2.7.4 and it will work again. Just uninstall the 3.0.0 and install the 2.7.4.

Can you solve this problem? thanks...

ChuckBell commented 3 years ago

Hi. Nope, sorry. We will have to wait for the ESP community at large to fix the 3.0.0 issue. Sorry.

On Jul 29, 2021, at 4:10 AM, ChinaBurn @.***> wrote:

I have confirmed this is a bug in the ESP8266 v3.0 hardware code. You can revert to 2.7.4 and it will work again. Just uninstall the 3.0.0 and install the 2.7.4.

Can you solve this problem? thanks...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/171#issuecomment-888900008, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYGNHZR2IBFPKBNFCH3T2EEHFANCNFSM45MDIOAQ.

d-a-v commented 2 years ago

@ChuckBell Before we can track this inside the esp8266 Arduino core, can you please fix this coding issue identified in your library by @mcspr and @Pablo2048 ? https://github.com/esp8266/Arduino/issues/8335#issuecomment-941008355 https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/176#issuecomment-941966423