Proof of Concept

ESP32 MSSQL Client

Microsoft SQL Server client for ESP32 over WiFi (not Ethernet)

Status: This project is a proof-of-concept implementation and requires further development, testing, and validation before production use.

Note: Unlike the other projects on this site, this client uses WiFi connectivity rather than Ethernet.

ESP32

Overview

A complete ESP-IDF application for connecting ESP32 devices to Microsoft SQL Server databases. This project provides a complete solution for ESP32 devices to connect to Microsoft SQL Server databases, including a C/C++ client library wrapping the tdslite TDS protocol implementation, NVS-based credential storage with password obfuscation, and a web-based configuration interface.

The application automatically starts a web server when SQL credentials are not configured, allowing easy setup via a web browser. Once configured, the device can execute SQL queries (INSERT, UPDATE, DELETE, DDL statements) and store data directly in SQL Server databases.

Architecture

The project consists of the following components:

Key Features

Hardware Requirements

Software Requirements

Configuration

Initial Setup via Web UI

  1. Flash the application to your ESP32
  2. Connect the device to WiFi (configured in main/main.c)
  3. Wait for the device to start and connect to WiFi
  4. Check serial monitor for the web server IP address
  5. Open the IP address in a web browser
  6. Fill in SQL Server credentials (server, port, database, username, password)
  7. Click Test to verify connection (optional)
  8. Click Save to store credentials
  9. Device will reboot automatically after saving

Manual Configuration (Programmatic)

You can also configure credentials programmatically using the sql_credentials component API.

Usage

Basic SQL Operations

After credentials are configured, the device will automatically:

Supported Query Types

The client supports the following SQL operations:

Note: This function does NOT return result sets. Use only for INSERT, UPDATE, DELETE, and DDL statements.

API Documentation

ESP32_MSSQLClient API

Key functions provided by the client library:

SQL Credentials API

Security Considerations

Password Storage

Passwords are obfuscated before storage in NVS using a simple XOR cipher. This provides:

Network Security

WiFi vs Ethernet

Important: Unlike the other projects on this site, this client uses WiFi connectivity rather than Ethernet. This makes it suitable for applications where WiFi is preferred or required, but it is not designed for the deterministic, industrial-grade networking that Ethernet provides.

Example Application

The example application demonstrates:

License

This project is licensed under the MIT License. The project uses the tdslite library, which is also licensed under the MIT License.