ChuckBell / MySQL_Connector_Arduino

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

Arduino MKR1010 Connection Issue #90

Closed Ch4rlesB closed 2 years ago

Ch4rlesB commented 5 years ago

I have a arduino mkr1010 board with integrated wifi.

It uses WifiNINA instead of WiFi library. I know the credentials and port are correct because I can connect to the DB via a java script I wrote. I can connect to my wifi but it never connects to the DB. Is there an issue with the fact I am using the mkr1010?

*/

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

include

include

IPAddress server_addr(127,0,0,1); // IP of the MySQL server here char user[] = "admin"; // MySQL user login username char password[] = "secret"; // MySQL user login password

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

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

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

// Begin WiFi section int status = WiFi.begin(ssid, pass); if ( status != WL_CONNECTED) { Serial.println("Couldn't get a wifi connection"); while(true); } // print out info about the connection: else { Serial.println("Connected to network"); IPAddress ip = WiFi.localIP(); Serial.print("My IP address is: "); Serial.println(ip); } // End WiFi section

Serial.println("Connecting..."); if (conn.connect(server_addr, 33060, user, password)) { delay(1000); } else Serial.println("Connection failed."); conn.close(); }

void loop() { }

ChuckBell commented 5 years ago

There are a couple of issues and one potential issue.

Did you change the connector code to use WiFiNINA.h? See the #include in the connector code and change it.

The connector does not “speak” X Protocol. You must use the older protocol. So, use port 3306, not 33060.

Set the server IP to the actual IP, not local host or loopback. The connector won’t work with the loopback address.

On Wed, Mar 13, 2019 at 10:27 CharlesBarette notifications@github.com wrote:

I have a arduino mkr1010 board with integrated wifi.

It uses WifiNINA instead of WiFi library. I know the credentials and port are correct because I can connect to the DB via a java script I wrote. I can connect to my wifi but it never connects to the DB. Is there an issue with the fact I am using the mkr1010?

*/

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

include

include

IPAddress server_addr(127,0,0,1); // IP of the MySQL server here char user[] = "admin"; // MySQL user login username char password[] = "secret"; // MySQL user login password

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

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

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

// Begin WiFi section int status = WiFi.begin(ssid, pass); if ( status != WL_CONNECTED) { Serial.println("Couldn't get a wifi connection"); while(true); } // print out info about the connection: else { Serial.println("Connected to network"); IPAddress ip = WiFi.localIP(); Serial.print("My IP address is: "); Serial.println(ip); } // End WiFi section

Serial.println("Connecting..."); if (conn.connect(server_addr, 33060, user, password)) { delay(1000); } else Serial.println("Connection failed."); conn.close(); }

void loop() { }

— 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/90, or mute the thread https://github.com/notifications/unsubscribe-auth/AH0j4PkMR0QorVpEP_kab8XrSSYDaoyYks5vWQrhgaJpZM4btW09 .

Ch4rlesB commented 5 years ago

There are a couple of issues and one potential issue. Did you change the connector code to use WiFiNINA.h? See the #include in the connector code and change it. The connector does not “speak” X Protocol. You must use the older protocol. So, use port 3306, not 33060. Set the server IP to the actual IP, not local host or loopback. The connector won’t work with the loopback address. On Wed, Mar 13, 2019 at 10:27 CharlesBarette @.**> wrote: I have a arduino mkr1010 board with integrated wifi. It uses WifiNINA instead of WiFi library. I know the credentials and port are correct because I can connect to the DB via a java script I wrote. I can connect to my wifi but it never connects to the DB. Is there an issue with the fact I am using the mkr1010? / #include // Use this for WiFi instead of Ethernet.h #include #include IPAddress server_addr(127,0,0,1); // IP of the MySQL server here char user[] = "admin"; // MySQL user login username char password[] = "secret"; // MySQL user login password // WiFi card example char ssid[] = "BdeB"; // your SSID char pass[] = ""; // your SSID Password WiFiClient client; // Use this for WiFi instead of EthernetClient MySQL_Connection conn((Client *)&client); void setup() { Serial.begin(115200); while (!Serial); // wait for serial port to connect. Needed for Leonardo only // Begin WiFi section int status = WiFi.begin(ssid, pass); if ( status != WL_CONNECTED) { Serial.println("Couldn't get a wifi connection"); while(true); } // print out info about the connection: else { Serial.println("Connected to network"); IPAddress ip = WiFi.localIP(); Serial.print("My IP address is: "); Serial.println(ip); } // End WiFi section Serial.println("Connecting..."); if (conn.connect(server_addr, 33060, user, password)) { delay(1000); } else Serial.println("Connection failed."); conn.close(); } void loop() { } — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#90>, or mute the thread https://github.com/notifications/unsubscribe-auth/AH0j4PkMR0QorVpEP_kab8XrSSYDaoyYks5vWQrhgaJpZM4btW09 .

I changed from my schools DB to a local database to be able to use port 3306. I also got my computers ip and changed it to that.

Where does one find the connector code?

ChuckBell commented 5 years ago

In your Arduino library folder.

On Wed, Mar 13, 2019 at 12:25 CharlesBarette notifications@github.com wrote:

There are a couple of issues and one potential issue. Did you change the connector code to use WiFiNINA.h? See the #include in the connector code and change it. The connector does not “speak” X Protocol. You must use the older protocol. So, use port 3306, not 33060. Set the server IP to the actual IP, not local host or loopback. The connector won’t work with the loopback address. … <#m-288376167505301629> On Wed, Mar 13, 2019 at 10:27 CharlesBarette @.**> wrote: I have a arduino mkr1010 board with integrated wifi. It uses WifiNINA instead of WiFi library. I know the credentials and port are correct because I can connect to the DB via a java script I wrote. I can connect to my wifi but it never connects to the DB. Is there an issue with the fact I am using the mkr1010? / #include // Use this for WiFi instead of Ethernet.h #include #include IPAddress server_addr(127,0,0,1); // IP of the MySQL server here char user[] = "admin"; // MySQL user login username char password[] = "secret"; // MySQL user login password // WiFi card example char ssid[] = "BdeB"; // your SSID char pass[] = ""; // your SSID Password WiFiClient client; // Use this for WiFi instead of EthernetClient MySQL_Connection conn((Client *)&client); void setup() { Serial.begin(115200); while (!Serial); // wait for serial port to connect. Needed for Leonardo only // Begin WiFi section int status = WiFi.begin(ssid, pass); if ( status != WL_CONNECTED) { Serial.println("Couldn't get a wifi connection"); while(true); } // print out info about the connection: else { Serial.println("Connected to network"); IPAddress ip = WiFi.localIP(); Serial.print("My IP address is: "); Serial.println(ip); } // End WiFi section Serial.println("Connecting..."); if (conn.connect(server_addr, 33060, user, password)) { delay(1000); } else Serial.println("Connection failed."); conn.close(); } void loop() { } — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <

90 https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/90>, or

mute the thread https://github.com/notifications/unsubscribe-auth/AH0j4PkMR0QorVpEP_kab8XrSSYDaoyYks5vWQrhgaJpZM4btW09 .

I changed from my schools DB to a local database to be able to use port 3306. I also got my computers ip and changed it to that.

Where does one find the connector code?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/90#issuecomment-472498121, or mute the thread https://github.com/notifications/unsubscribe-auth/AH0j4JjHD5BuxjSqPylVXAxe9181Wca5ks5vWSZkgaJpZM4btW09 .

Ch4rlesB commented 5 years ago

I have in the library folder, MySQL_connection.h and MySQL_connection.cpp and in none can I find an include with something I would replace with the WiFiNINA

ChuckBell commented 5 years ago

See MySQL_Packet.h

On Thu, Mar 14, 2019 at 11:21 CharlesBarette notifications@github.com wrote:

I have in the library folder, MySQL_connection.h and MySQL_connection.cpp and in none can I find an include with something I would replace with the WiFiNINA

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/90#issuecomment-472915175, or mute the thread https://github.com/notifications/unsubscribe-auth/AH0j4BavV3mJymmjSslIXdzu6z_yrg1rks5vWmjrgaJpZM4btW09 .

ChuckBell commented 2 years ago

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