MySQL Forums :: Connector/Arduino :: Trouble Getting mysql connection.

Advanced Search

Trouble Getting mysql connection.
Posted by: Aaron Ang ()
Date: August 12, 2015 04:24AM

So I've been trying to use the connected and I've used ipconfig to get my IP address of my database and i've entered the following code to try and push a simple "hello" onto my database but I keep getting the message

Connection failed.

Here's my current code.

* Example: Insert Example: Hello, MySQL!
* This code module demonstrates how to create a simple
* database-enabled sketch with inserting data.
#include "SPI.h"
#include "Ethernet.h"
#include "sha1.h"
#include "mysql.h"
/* Setup for Ethernet Library */
byte mac_addr[] = { 0x90, 0xA2, 0xDA, 0x0F, 0x3A, 0xDC };
IPAddress server_addr(192,168,1,240);
/* Setup for the Connector/Arduino */
Connector my_conn; // The Connector/Arduino reference
char user[] = "ang";
char password[] = "";//myset password
char INSERT_SQL[] =
"INSERT INTO test_arduino.hello_arduino (message) VALUES ('Hello, Arduino!')";
void setup() {
while (!Serial);
if (my_conn.mysql_connect(server_addr, 3306, user, password)){
Serial.println("Data inserted.");
} else {
Serial.println("Connection failed.");
void loop() {

Options: ReplyQuote

Subject Views Written By Posted
Trouble Getting mysql connection. 1377 Aaron Ang 08/12/2015 04:24AM
Re: Trouble Getting mysql connection. 599 Charles Bell 08/14/2015 08:00AM

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.