ChuckBell / MySQL_Connector_Arduino

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

Connecting... #117

Closed meblehaag closed 4 years ago

meblehaag commented 4 years ago

Hello. I have arduino uno with hanrun shield. When I use "basic select" or "basic insert" i only get "Connecting..." nothing more. I can wait and wait and nothing will happened. Credentials are ok, I'm sure. Even with bad pass like one below I get only "Connecting". Where can start looking for problem ? With regards DJ.

include

include

include

//byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; byte mac_addr[] = { 0x00, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress server_addr(77,55,130,167); // IP of the MySQL server here char user[] = "vivamedia1_33"; // MySQL user login username char password[] = "somepass"; // MySQL user login password

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

EthernetClient client; MySQL_Connection conn((Client *)&client);

void setup() { Serial.begin(9600); while (!Serial); // wait for serial port to connect Ethernet.begin(mac_addr); Serial.println("Connecting..."); if (conn.connect(server_addr, 3306, user, password)) { delay(1000); } else Serial.println("Connection failed."); }

void loop() { delay(2000);

Serial.println("Recording data.");

// Initiate the query class instance MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn); // Execute the query cur_mem->execute(INSERT_SQL); // Note: since there are no results, we do not need to read any data // Deleting the cursor also frees up memory used delete cur_mem; }

ChuckBell commented 4 years ago

May be a hardware or library incompatibility. I am not familiar with that shield. Can you post a link to its specifications?

On Dec 1, 2019, at 3:07 PM, meblehaag notifications@github.com wrote:

Hello. I have arduino uno with hanrun shield. When I use "basic select" or "basic insert" i only get "Connecting..." nothing more. I can wait and wait and nothing will happened. Credentials are ok, I'm sure. Even with bad pass like one below I get only "Connecting". Where can start looking for problem ? With regards DJ.

include

include

include

//byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; byte mac_addr[] = { 0x00, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress server_addr(77,55,130,167); // IP of the MySQL server here char user[] = "vivamedia1_33"; // MySQL user login username char password[] = "somepass"; // MySQL user login password

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

EthernetClient client; MySQL_Connection conn((Client *)&client);

void setup() { Serial.begin(9600); while (!Serial); // wait for serial port to connect Ethernet.begin(mac_addr); Serial.println("Connecting..."); if (conn.connect(server_addr, 3306, user, password)) { delay(1000); } else Serial.println("Connection failed."); }

void loop() { delay(2000);

Serial.println("Recording data.");

// Initiate the query class instance MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn); // Execute the query cur_mem->execute(INSERT_SQL); // Note: since there are no results, we do not need to read any data // Deleting the cursor also frees up memory used delete cur_mem; }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/117?email_source=notifications&email_token=AB6SHYGF744VHXDDOEKTLTLQWQKRNA5CNFSM4JTNNVI2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H5DFOWQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYBIEKR2UGJ2GR3MBZLQWQKRNANCNFSM4JTNNVIQ.

meblehaag commented 4 years ago

Hello ChuckBell I not at the home at that moment but quite sure it is Ethernet shield W5100, like this one: https://pl.aliexpress.com/item/2038554597.html

What ethernet shield or arduino do you recommend ?

meblehaag commented 4 years ago

I would really like to start using your library mysql is most important "thing" in this days.

meblehaag commented 4 years ago

W5100_datasheet.pdf

ChuckBell commented 4 years ago

Ok, that board looks like it should work. I would suggest following the troubleshooting tips in the manual. Specifically, making sure the network port your using along with the IP address of the server is reachable.

meblehaag commented 4 years ago

Hello there! My credentials and code was ok. I bought this shield W5500: https://store.arduino.cc/arduino-ethernet-shield-2 Just made only change in MySQL_Packet.h like in manual and it works !

ChuckBell commented 4 years ago

Great! Please close the issue if you’ve got it working.

On Wed, Dec 4, 2019 at 14:32 meblehaag notifications@github.com wrote:

Hello there! My credentials and code was ok. I bought this shield W5500: https://store.arduino.cc/arduino-ethernet-shield-2 Just made only change in MySQL_Packet.h like in manual and it works !

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/117?email_source=notifications&email_token=AB6SHYFKIU22WVWOBS6T25TQXAAT7A5CNFSM4JTNNVI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF6HESI#issuecomment-561803849, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYAE4PBQNHZUOMHJEBDQXAAT7ANCNFSM4JTNNVIQ .