Ethercard Library to XAMPP MySQL

Good Day..

Im trying to connect my Arduino Mega 2560 to XAMPP MySQL.

I have a code using Ethernet.h from Dr. Charlesbell blog. I want to convert it using Ethercard.h library instead of Ethernet.h

Here's the code:

/**
* Example: Hello, MySQL!
*
* This code module demonstrates how to create a simple
* database-enabled sketch.
*/
#include "SPI.h"
#include "Ethernet.h"
#include "sha1.h"
#include "mysql.h"
/* Setup for Ethernet Library */
byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server_addr(10, 0, 1, 10);
/* Setup for the Connector/Arduino */
Connector my_conn; // The Connector/Arduino reference
char user[] = "bob";
char password[] = "secret";
void setup() {
 Ethernet.begin(mac_addr);
 Serial.begin(115200);
 while (!Serial);
 delay(1000);
 Serial.println("Connecting...");
 if (my_conn.mysql_connect(server_addr, 3306, user, password)){
 Serial.println("Success!");
 } else {
 Serial.println("Connection failed.");
 }
}
void loop() {
}

Thanks :slight_smile:

I want to convert it using Ethercard.h library instead of Ethernet.h

Permission is granted. Proceed.