Can I use MYSQL Connector Library for sim808?

I want to retrieve data from database using sim808. I saw mysql connector library while I was searching. But in all examples, this library are using with ethernet shield. Can I use this library for sim808? Is there a way?

#include <Ethernet.h>
#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>

byte mac_addr = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress server_addr(10,0,1,35); // IP of the MySQL server here
char user = “root”; // MySQL user login username
char password = “secret”; // MySQL user login password

// Sample query
char query = “SELECT * FROM LIMIT 12”;

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

void setup() {
while (!Serial); // wait for serial port to connect
if (conn.connect(server_addr, 3306, user, password)) {
Serial.println(“Connection failed.”);

void loop() {

Serial.println("\nRunning SELECT and printing results\n");

// Initiate the query class instance
MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn);
// Execute the query
// Fetch the columns and print them
column_names *cols = cur_mem->get_columns();
for (int f = 0; f < cols->num_fields; f++) {
if (f < cols->num_fields-1) {
Serial.print(", “);
// Read the rows and print them
row_values *row = NULL;
do {
row = cur_mem->get_next_row();
if (row != NULL) {
for (int f = 0; f < cols->num_fields; f++) {
if (f < cols->num_fields-1) {
Serial.print(”, ");
} while (row != NULL);
// Deleting the cursor also frees up memory used
delete cur_mem;

Can I use this library for sim808?


The proper way to save data in, and retrieve data from, a MySQL (or any other kind of relational database) is to make a GET request to a script (usually a PHP script) where the data to be saved, or the selection criteria, is part of the GET request.

That approach can be used with an Ethernet shield, a WiFi shield, or a GPRS shield.

You need some type of network connectivity in order to access the MySQL.