Connect Arduino to SQL Server

9

I'm wanting to keep a database up to date with the Arduino sensor outputs. I would like to know if it is possible to directly connect Arduino to SQL Server for sending and receiving data.

Or would the only option be to make an intermediate application between the two?

    
asked by anonymous 08.05.2015 / 16:01

2 answers

6

Arduino UNO / Mega and Similar

In the case of Arduino using AVR line microcontrollers like Arduino UNO and Arduino Mega, there is no way to implement client drivers for SQL Server, there is a SQL Driver for MySQL, however there is no security in using such drivers already that these can not encrypt the connection to the database and preserve authentication information because the AVR Microcontroller is 8 bits and does not have computational power for such algorithms.

Arduino DUE and Similar

Arduino DUE-like versions may have more elaborate drivers, but they will still be weak in security, even using the ARM architecture will not always have a mathematical co-processor suitable for the mathematical operations required for encryption.

Arduino Galileo, Yum and others using Linux

The Arduino Galileo and Arduino Yum versions may have drivers for SQL Server, but have not yet been made available, you can try to adapt a driver for Linux in these environments by recompiling the driver.

In general

In all cases, the best solution is to have a Broker that will provide a certain level of security and adaptation of the information sent.

    
11.06.2015 / 17:48
10

Unfortunately, there are no native SQL Server drivers that you can use directly from Arduino.

You can use a Web application such as broker to post values of your sensors.

EthernetClient client;

void setup() {
  Serial.begin(9600);
   while (!Serial) {
    ; // Aguardar a conexão da Serial
  }

  // Inicia conexão via Ethernet:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Falha na configuracao do DHCP");
    // Tente forçar um IP, caso o DHCP falhe:
    Ethernet.begin(mac, ip);
  }
  // Aguardar a inicializacao da Ethernet
  delay(1000);
  Serial.println("conectando...");

  if (client.connect("servidor", 80)) {
    Serial.println("connected");
    // Make a HTTP request:
    client.println("GET /recebedadossensores?s1=" + valor1 + " HTTP/1.1");
    client.println("Host: servidor");
    client.println("Connection: close");
    client.println();
  }
    
21.05.2015 / 17:30