Connect Arduino to SQL Server

Asked

Viewed 3,219 times

9

I’m looking to keep an updated database with the outputs of the Arduino sensors. I wonder if it is possible to connect directly the Arduino to SQL Server for sending and receiving data.

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

2 answers

10

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

You can use a web application such as Broker to post values from 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();
  }

6


Arduino UNO/Mega and similar

When it comes to the Arduino using AVR line microcontrollers like Arduino UNO and Arduino Mega, there is no way to implement client drivers for SQL Server, there is an SQL Driver for Mysql, however there is no security in using such drivers since these cannot encrypt the connection to the bank and preserve authentication information, because the AVR Microcontroller is 8 bits and does not have computational power for such algorithms.

Arduino DUE and Similar

The versions similar to Arduino DUE may have more elaborate drivers, but still will be weak in security, even using the ARM architecture will not always have a mathematical cooprocessor suitable the mathematical operations necessary for encryption.

Arduino Galileu, Yum and others who use Linux

Arduino Galileo and Arduino Yum versions may have SQL Server drivers, but they haven’t been made available yet, you may be trying to adapt some Linux driver in these environments by recompiling the driver.

In General

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

  • Good exploitation of the options! + 1.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.