ChuckBell / MySQL_Connector_Arduino

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

[E][WiFiClient.cpp:220] connect(): lwip_connect_r: 118 FAILED. #99

Closed williamesp2015 closed 2 years ago

williamesp2015 commented 5 years ago

I am using ESP32 and I have my website and I can access to Panel like this (xx,xx,xx,xx:4041). If I try to use dbport 3306 or 4041 I get Error: [E][WiFiClient.cpp:220] connect(): lwip_connect_r: 118 FAILED. 1) How to create Table on my website opr on my PC then upload it? 2) How to use my complete address:xx,xx,xx,xx:4041 3) What is server side php, java, ect to answer to my ESP32

Thank you

ChuckBell commented 5 years ago

Hello. Here are some answers to your direct questions.

  1. How to create Table on my website opr on my PC then upload it? You don't. You create the table on the server using the CREATE TABLE command. See the MySQL online reference manual for more details. https://dev.mysql.com/doc/refman/8.0/en/

  2. How to use my complete address:xx,xx,xx,xx:4041 You specify the IP address in an array and pass 4041 into the connect() method of the connector as the port.

  3. What is server side php, java, ect to answer to my ESP32 Sorry, cannot help you there. I don't know what this has to do with the connector and Arduino sketches.

That said, I am not familiar with the error you are seeing. I suspect several things. Please check each of these to investigate your issues further as or if they apply.

a) Are you using the correct ESP Wifi library? You must use an ESP32 compatible WiFi library and modify the mysql_packet.h file to change the #include from Ethernet to the ESP class. Take care here because not all ESP-compatible libraries will work. Only those that are also compatible with the Arduino Enternet classes will work. Check the other posts here for clues.

b) Are you using the Arduino IDE to compile your sketch? If you are using a different compiler, you must make certain you are referencing the correct hardware libraries. It can be especially tricky for those new to working outside of the Arduino IDE.

c) Is your MySQL server behind a firewall? If your host server has a firewall blocking incoming traffic, the connection will fail.

d) Port 4041 is an unusual port. Check your MySQL server configuration to ensure that port is correct.

e) Are you using an Oracle provided MySQL server? The connector has known issues with non-Oracle servers, especially in connection and query results. Some have had success despite this limitation, but it is something you should check.

Finally, my advice is to not jump directly to a web hosted solution. Start small by installing MySQL (Oracle's MySQL) on your local computer and use it to develop your sketch one step at a time. This will also permit you to learn the commands you need to create your database and tables as well as sample data. Once you have the sketch working, you can then change it to work with the web hosted database. Not only does this eliminate many potential pitfalls (such as a firewall or hosted service account limitations), it will also allow you to learn by doing rather than hoping for something or someone to guide you.

If you take this advice, and you create the database and tables you want to use, you can either copy and paste those commands into a connection to the web hosted MySQL or use mysqlpump to backup the data locally then restore it on the web hosted MySQL.

ChuckBell commented 2 years ago

Closed due to inactivity. Please open a new ticket if this is still relevant.