Sqlite gen_server port for Erlang. Creates, reads and writes to sqlite database.
Branch: master
Clone or download
Pull request Compare This branch is 116 commits ahead, 3 commits behind sergey-miryanov:master.
Latest commit 7cf50f8 May 10, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
.settings Added project files Apr 19, 2012
c_src Fixed compile warning May 9, 2016
include Fixed handling of errors after columns are determined Apr 19, 2012
sqlite3_amalgamation Bump SQLite amalgation Aug 6, 2015
src Use binary:replace instead of re:replace to handle Latin-1 binaries Dec 21, 2015
.gitignore More organized .gitignore Oct 18, 2014
.project Added project files Apr 19, 2012
.travis.yml Add 17.4 support Aug 9, 2015
AUTHORS Add an authors file which traces the history of my specific fork Oct 12, 2010
GNUmakefile Don't remove priv/ entirely on make clean. Jan 15, 2011
LICENSE CEAN packaging requires LICENSE. Aug 7, 2008
Makefile Simplify building on Windows Oct 11, 2014
README.md Use single codebase for all Erlang versions Oct 12, 2014
build_port_win32.bat Simplify building on Windows Oct 11, 2014
build_port_win64.bat Simplify building on Windows Oct 11, 2014
rebar Updated rebar Oct 18, 2014
rebar.bat Add rebar.bat Dec 17, 2010
rebar.config Fix OS X Aug 9, 2015
rebar.cross_compile.config.sample Moved cross-compilation config into master branch Nov 18, 2010
rebar.debug.config Define DEBUG macros in rebar.debug.config Apr 20, 2011
test.erl Add get changes Mar 15, 2015
test.sh Separate rebar.config for dialyzer/gdb/valgrind Jan 13, 2011


Erlang wrapper for SQLite3

This library allows you to work with SQLite3 databases from Erlang.

It is compatible with Windows and Linux, and should probably work on other OSes as well.

Build Status

See also esqlite for an alternative library.


Erlang/OTP R14B or later is required (tested up to 17.3 at this writing), and SQLite 3 minimum version is 3.6.1.



  1. Install SQLite3 by running sudo apt-get install sqlite3 or the equivalent for your package manager, or by compiling from the source.

  2. make.


If you want to use erlang-sqlite3 on an embedded device, it can be cross-compiled.

  1. Cross-compile SQLite3 and Erlang.

  2. Change variables and paths in rebar.cross_compile.config.sample to the desired values and rename it to rebar.cross_compile.config.

  3. make cross_compile.

Windows with MS Visual C++

To build both SQLite3 and sqlite3-erlang:

  1. If MSVC tools (cl, link, etc.) are not in the path, run vcvars32.bat or vcvars64.bat depending on whether you use 32-bit or 64-bit Erlang. build_port_win32.bat and build_port_win64.bat have the standard paths for VC10.0.

  2. nmake.

Alternately, you can use prebuilt versions of sqlite3.dll and sqlite3.def. To make sqlite3.lib, use lib /def:sqlite3.def. Then remove sqlite3.dll and sqlite3.lib targets from Makefile and do as above.

Potential compilation problems

  • If SQLite was built with SQLITE_OMIT_LOAD_EXTENSION option, you'll need to undefine ERLANG_SQLITE3_LOAD_EXTENSION macro in <c_src/sqlite3_drv.h>.

Running the test suite


make test


  1. nmake tests

  2. If you get the error "Error loading sqlite3_drv: The specified module could not be found", this is because sqlite3.dll isn't in the search path.

Example usage

See tests test/sqlite3_test.erl for a starting point. On Windows note that sqlite3.dll must be in your application's working directory or somewhere in the DLL search path.