MySQL Forums
Forum List  »  Connector/Arduino

Re: I use MySQL connectorl and after some time it stops. PLEASE HELP
Posted by: Chuck Bell
Date: November 07, 2016 08:21PM

Like this. Sorry, I said "disconnect" as in the action, not the method needed. Close is the method to disconnect.

void loop() {
Serial.println("Sleeping...");
delay(2000);
Serial.println("Connecting...");
if (conn.connect(server_addr, 3306, user, password)) {
delay(500);
Serial.println("Running a query");
cur.execute("SHOW DATABASES"); // execute a query
cur.show_results(); // show the results
cur.close(); // close the cursor
conn.close(); // close the connection
} else {
Serial.println("Connect failed. Trying again on next iteration.");
}
}

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: I use MySQL connectorl and after some time it stops. PLEASE HELP
1390
November 07, 2016 08:21PM


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.