{"id":16239809,"url":"https://github.com/nopnop2002/esp-idf-remote-sqlite3","last_synced_at":"2025-06-23T19:06:47.723Z","repository":{"id":108987850,"uuid":"308840094","full_name":"nopnop2002/esp-idf-remote-sqlite3","owner":"nopnop2002","description":"Remote-Sqlite access for esp-idf","archived":false,"fork":false,"pushed_at":"2022-03-27T08:58:01.000Z","size":26,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T14:39:19.014Z","etag":null,"topics":["db","dbms","esp-idf","esp32","http","rest","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nopnop2002.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-31T08:45:04.000Z","updated_at":"2022-10-25T00:38:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"3940dc3b-c1e1-4828-ac8a-98db67e0093f","html_url":"https://github.com/nopnop2002/esp-idf-remote-sqlite3","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nopnop2002/esp-idf-remote-sqlite3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-remote-sqlite3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-remote-sqlite3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-remote-sqlite3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-remote-sqlite3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nopnop2002","download_url":"https://codeload.github.com/nopnop2002/esp-idf-remote-sqlite3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-remote-sqlite3/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261539318,"owners_count":23174136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["db","dbms","esp-idf","esp32","http","rest","sqlite3"],"created_at":"2024-10-10T13:45:13.531Z","updated_at":"2025-06-23T19:06:47.160Z","avatar_url":"https://github.com/nopnop2002.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esp-idf-remote-sqlite3\nRemote sqlite3 access example for esp-idf.   \nYou can access sqlite3 on the server over the network.   \nUse [this](https://github.com/alixaxel/ArrestDB) as PHP script of WEB server.   \n\n![remote-sqlite3](https://user-images.githubusercontent.com/6020549/97775795-c21af600-1ba6-11eb-9d02-04dcaca058c7.jpg)\n\n# Server Side\n\n## Install sqlite3   \n```\n$ sudo apt install sqlite3\n```\n\n## Create sqlite3 database   \nRun the following script in any directory.   \n```\n#!/bin/bash\n#set -x\n\nif [ -z $(which sqlite3) ];then\n  echo \"sqlite3 not found.\"\n  exit -1\nfi\n\ncd $(dirname $0)\ndbfile=$1\nif [ $# -ne 1 ];then\n  dbfile=\"example.db\"\n  echo \"Create ${dbfile}\"\nfi\n\n\n# Create Database\nif [ ! -e ${dbfile} ];then\n  echo \".open ${dbfile}\" | sqlite3\n  echo \"build database\"\nelse\n  echo \"database already exists\"\nfi\n\noption=\"-noheader -separator ,\"\nsqlite=\"sqlite3 ${option} ${dbfile} \"\n\n# Create Table\n${sqlite} \"create table if not exists customers( \\\nid integer primary key autoincrement, \\\nname varchar(255), \\\ngender int);\"\n\n# Insert Data\n${sqlite} \"insert into customers(name,gender) values(\\\"Luis\\\", 1);\"\n${sqlite} \"insert into customers(name,gender) values(\\\"Leonie\\\", 1);\"\n${sqlite} \"insert into customers(name,gender) values(\\\"Francois\\\", 2);\"\n${sqlite} \"insert into customers(name,gender) values(\\\"Bjorn\\\", 2);\"\n\n${sqlite} \"select * from customers;\"\n```\n\n## Install ArrestDB\n```\n$ cd $HOME\n$ git clone https://github.com/alixaxel/ArrestDB\n$ cd ArrestDB\n$ vi index.php\n\nSet the full path of the database in the following line.\n\n$dsn = '';\n\nFor example, if the database is /home/nop/esp-idf-remote-sqlite3/sqlite/example.db, it will be as follows.\n\n$dsn = 'sqlite:///home/nop/esp-idf-remote-sqlite3/sqlite/example.db';\n\n```\n\n## Install PHP\n```\n$ cd $HOME\n$ sudo apt install php\n\n$ php --version\nPHP 7.2.24-0ubuntu0.18.04.1 (cli) (built: Oct 28 2019 12:07:07) ( NTS )\nCopyright (c) 1997-2018 The PHP Group\nZend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies\n    with Zend OPcache v7.2.24-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies\n```\n\n## Install PDO driver for Sqlite3\n```\n$ sudo apt-get install php[Version]-sqlite3\n```\n\nWhen the PHP version is 7.2.x, execute the following.   \n```\n$ sudo apt-get install php7.2-sqlite3\n```\n\n\n## Start Built-in WEB Server\n```\n$ php -S 0.0.0.0:8080 -t $HOME/ArrestDB\nPHP 7.2.24-0ubuntu0.18.04.7 Development Server started at Sat Oct 31 18:00:29 2020\nListening on http://0.0.0.0:8080\nDocument root is /home/nop/ArrestDB\nPress Ctrl-C to quit.\n```\n\n\n## Test ArrestDB\n```\n$ curl \"http://localhost:8080/customers/\"\n[\n    {\n        \"id\": \"1\",\n        \"name\": \"Luis\",\n        \"gender\": \"1\"\n    },\n    {\n        \"id\": \"2\",\n        \"name\": \"Leonie\",\n        \"gender\": \"1\"\n    },\n    {\n        \"id\": \"3\",\n        \"name\": \"Francois\",\n        \"gender\": \"2\"\n    },\n    {\n        \"id\": \"4\",\n        \"name\": \"Bjorn\",\n        \"gender\": \"2\"\n    }\n]\n```\n\n---\n\n# ESP32 Side\n\n\n## Software requirements\nesp-idf ver4.1 or later.   \n\n## Install\n\n```\ngit clone https://github.com/nopnop2002/esp-idf-remote-sqlite3\ncd esp-idf-remote-sqlite3/\nidf.py menuconfig\nidy.py flash monitor\n```\n\nYou have to set this config value with menuconfig.   \n- CONFIG_ESP_WIFI_SSID   \nSSID of your wifi.\n- CONFIG_ESP_WIFI_PASSWORD   \nPASSWORD of your wifi.\n- CONFIG_ESP_MAXIMUM_RETRY   \nMaximum number of retries when connecting to wifi.\n- CONFIG_ESP_WEB_SERVER_IP   \nIP or DNS of your WEB Server.\n- CONFIG_ESP_WEB_SERVER_PORT   \nPort number of your WEB Server.\n\n![menuconfig-1](https://user-images.githubusercontent.com/6020549/97775496-79623d80-1ba4-11eb-99cc-1b309aa1689b.jpg)\n![menuconfig-2](https://user-images.githubusercontent.com/6020549/160274237-2b87a981-f8e8-481b-9d01-77675ea58306.jpg)\n\n## Read all data\n```\nI (3241) SQLITE: -----------------------------------------\nI (3251) SQLITE: 1      Luis    1\nI (3251) SQLITE: 2      Leonie  1\nI (3251) SQLITE: 3      Francois        2\nI (3261) SQLITE: 4      Bjorn   2\nI (3261) SQLITE: -----------------------------------------\n```\n\n## Read by ID\n```\nI (4331) SQLITE: -----------------------------------------\nI (4331) SQLITE: 3      Francois        2\nI (4331) SQLITE: -----------------------------------------\n```\n\n## Read by gender\n```\nI (5141) SQLITE: -----------------------------------------\nI (5141) SQLITE: 3      Francois        2\nI (5141) SQLITE: 4      Bjorn   2\nI (5151) SQLITE: -----------------------------------------\n```\n\n## Create new record\n```\nI (5891) SQLITE: -----------------------------------------\nI (5901) SQLITE: 5      Tom     1\nI (5901) SQLITE: -----------------------------------------\n```\n\n## Update record\n```\nI (18131) SQLITE: -----------------------------------------\nI (18141) SQLITE: 5     Petty   2\nI (18141) SQLITE: -----------------------------------------\n```\n\n## Delete record\n```\nI (31881) SQLITE: -----------------------------------------\nI (31881) SQLITE: 1     Luis    1\nI (31881) SQLITE: 2     Leonie  1\nI (31891) SQLITE: 3     Francois        2\nI (31891) SQLITE: 4     Bjorn   2\nI (31891) SQLITE: -----------------------------------------\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnopnop2002%2Fesp-idf-remote-sqlite3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnopnop2002%2Fesp-idf-remote-sqlite3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnopnop2002%2Fesp-idf-remote-sqlite3/lists"}