MySQL Forums
Forum List  »  Connector/Arduino

Client disconnects from MySql server
Posted by: ste z
Date: May 23, 2014 09:26AM

I'm facing a problem with the connection to my MySql server.
The connection is lost every 20-22 seconds and i have to connect again.
The connection to the WIFI network is not affected.
I would like to keep the connection alive even if there is no activity (INSERT statements), in order to reduce the delay. Note that the wait_timeout parameter in MySQL server is set to 28800 secs (default).


void setup()
{
Serial.begin(9600);
connectToWiFi();
connectToMySQL();
}

void checkMySQLConnection()
{
if (my_conn.is_connected() == 0)
{
Serial.println("Connection is lost");
connectToMySQL();
}

}


void loop()
{
checkWiFiConnection();
checkMySQLConnection();

//read pressure mat sensor
.
.
//INSERT data to db

delay(100);
}




Using Arduino Uno R3, Arduino WiFi shield R3 (firmware 1.0), and the latest MySql connector.

Any help would be greatly appreciated.

Options: ReplyQuote


Subject
Views
Written By
Posted
Client disconnects from MySql server
3928
May 23, 2014 09:26AM
2012
June 01, 2014 02:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.