4 Replies Latest reply on Oct 11, 2016 12:39 PM by Intel Corporation

    MySql Connector/arduino 1.1 on Galileo HELP!!

    Roberto0307081

      Hi, i'm trying to run the basic example of the library but the Sketch stops in the line "if (conn.connect(server_addr, 3306, user, password))" .
      I don't know what could be the problem.
      this is the code
      #include <Ethernet.h>
      #include <MySQL_Connection.h>
      #include <MySQL_Cursor.h>

      IPAddress server_addr(192,168,1,100); // IP of the MySQL *server* here
      char user[] = "cymo"; // MySQL user login username
      char password[] = "cymo"; // MySQL user login password
      // Sample query
      char query[] = "SELECT * FROM cymo_db.login";
      EthernetClient client;
      MySQL_Connection conn((Client *)&client);
      // Create an instance of the cursor passing in the connection
      MySQL_Cursor cur = MySQL_Cursor(&conn);
      void setup() {
      Serial.begin(115200);
      // eglibc ethernet naming...
      system("ifconfig eth0 192.168.1.222 netmask 255.255.255.0");
      Serial.println(Ethernet.localIP());

      while (!Serial); // wait for serial port to connect

      Serial.println("Connecting...");
      if (conn.connect(server_addr, 3306, user, password)) {
      delay(1000);
      }
      else
      Serial.println("Connection failed.");
      }

      When I upload the sketch to the galileo and turn on the serial monitor i can see
      192.168. 1.222
      Connecting...

      and nothing else of the sketch keeps running.
      I don't know if this is the right place to ask for this, but in your Blog i couldn't do it.
      Thanks.

      Roberto