nanodbc is distributed in form of source code package.

nanodbc is intentionally small enough that you can drag and drop the header and implementation files into your project and run with it.

Binary packages, if available, are provided and supported by third-parties, developers and maintainers of numerous package managers.


You can build nanodbc library, build and run tests using CMake.

git clone
cd nanodbc
mkdir build
cd build
cmake ..
cmake --build .
ctest -V --output-on-failure


  • C++ compiler with C++11/C++14 support

  • CMake 3.0.0 or later

  • ODBC SDK (unixODBC, iODBC, Windows SDK)

Optionally, you will also need:

  • ODBC drivers, depending on DBMS you want to target (eg. running tests).

  • Boost.Locale, alternative for Unicode conversion routines.

  • libc++, alternative C++11 and later implementation.


Although detailed build process depends on CMake generator used, number of common targets are always available.

For example, CMake configuration using Makefiles generator:

cd nanodbc
mkdir build
cd build
cmake -G "Unix Makefiles" [options] ..
make          # creates shared library
make nanodbc  # creates shared library
make tests    # builds the tests
make test     # runs the tests
make check    # builds and then runs tests
make examples # builds all the example programs
make install  # installs nanodbc.h and shared library

CMake OPTION and cache entry variables are available to specify with -D switch to enable or disable nanodbc built-in features.

All boolean options follow the CMake OPTION default value convention: if no initial value is provided, OFF is used.

List of CMake options specific to nanodbc, in alphabetical order:


Disable all async features. May resolve build issues in older ODBC versions.


Do not build examples.


Do not generate install target.


Do not use libc++, if available on the system.


Do not build tests. Do not generate test and check targets.


Use Boost for Unicode string convertions (requires Boost.Locale). Workaround to issue #44.


Enable Unicode support. nanodbc::string becomes std::u16string or std::u32string.


Enable SQL_NO_DATA workaround #33.


Force ODBC version to use. Possible values are SQL_OV_ODBC3 or SQL_OV_ODBC3_80. Default value is SQL_OV_ODBC3_80, if available.

Standard CMake options are also available, for example:


Build nanodbc as A shared library. Default value is OFF.

If you are not using CMake to build nanodbc, you will need to set the options, using the corresponding names, as preprocessor defines yourself.


Tests use the Catch test framework. CMake automatically fetches the latest version of Catch for you at build time.

Once nanodbc build is ready, use ctest to run tests in CMake generator-agnostic way:

ctest -V --output-on-failure

Alternatively, build test target (eg. make test).


This section aim to list all known binary packages of nanodbc.

If you maintain binary package of nanodbc and you’d like to list it here, please submit new entry via pull request or open an issue