https://github.com/nopnop2002/esp-idf-sql-client
SQL database access example for esp-idf
https://github.com/nopnop2002/esp-idf-sql-client
db dbms esp-idf esp32 mysql postgresql sql-query sqlite-database
Last synced: 7 months ago
JSON representation
SQL database access example for esp-idf
- Host: GitHub
- URL: https://github.com/nopnop2002/esp-idf-sql-client
- Owner: nopnop2002
- Created: 2020-01-04T01:47:23.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-02-16T18:14:46.000Z (12 months ago)
- Last Synced: 2025-04-03T04:41:36.677Z (10 months ago)
- Topics: db, dbms, esp-idf, esp32, mysql, postgresql, sql-query, sqlite-database
- Language: C
- Homepage:
- Size: 58.6 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# esp-idf-sql-client
SQL database access example for esp-idf.
You can access MySQL/PostgreSQL on the server over the network.
Use [this](https://github.com/mevdschee/php-crud-api) as PHP script of WEB server.

# Using MySQL
Install php-crud-api according to the following:
https://github.com/nopnop2002/esp-idf-sql-client/tree/master/mysql
# Using PostgreSQL
Install php-crud-api according to the following:
https://github.com/nopnop2002/esp-idf-sql-client/tree/master/pgsql
# Software requirements
ESP-IDF V5.0 or later.
ESP-IDF V4.4 release branch reached EOL in July 2024.
# Installation
```
git clone https://github.com/nopnop2002/esp-idf-sql-client
cd esp-idf-sql-client/
idf.py menuconfig
idf.py flash monitor
```
# Configuration
You have to set this config value with menuconfig.
- CONFIG_ESP_WIFI_SSID
SSID of your wifi.
- CONFIG_ESP_WIFI_PASSWORD
PASSWORD of your wifi.
- CONFIG_ESP_MAXIMUM_RETRY
Maximum number of retries when connecting to wifi.
- CONFIG_ESP_WEB_SERVER_IP
IP or mDNS of your WEB Server.
- CONFIG_ESP_WEB_SERVER_PORT
Port number of your WEB Server.
- CONFIG_ESP_PHP_PATH
Path of PHP Script,


# Read all data
```
I (7369) HTTP: -----------------------------------------
I (7379) HTTP: 1 1 1 blog started
I (7379) HTTP: 2 1 2 It works!
I (7379) HTTP: -----------------------------------------
```
# Read by ID
```
I (18249) HTTP: -----------------------------------------
I (18249) HTTP: 2 1 2 It works!
I (18249) HTTP: -----------------------------------------
```
# Create new record
```
I (26519) HTTP: -----------------------------------------
I (26519) HTTP: 3 1 3 Hello World
I (26529) HTTP: -----------------------------------------
```
# Update a new record
```
I (37739) HTTP: -----------------------------------------
I (37749) HTTP: 3 1 3 Hello Japan
I (37749) HTTP: -----------------------------------------
```
# Delete a new record
```
I (47959) HTTP: -----------------------------------------
I (47959) HTTP: 1 1 1 blog started
I (47969) HTTP: 2 1 2 It works!
I (47969) HTTP: -----------------------------------------
```