LDB(3)
β¨ NAME β¨
ldb β a light-weight database library π
okay bestie, buckle up, because this one is literally the moment a whole database library gets introduced to you and honestly? she's iconic.
π SYNOPSIS π
#include <ldb.h>
that's it. that's the whole vibe. one include and you're in π«Ά
π DESCRIPTION π
ldb is a light weight embedded database library and API. With a programming interface that is very similar to LDAP, ldb can store its data either in a tdb(3) database or in a real LDAP database. two options, zero drama β¨
when you're using it with the tdb backend, ldb does not require any database daemon. nope, none, she's independent π
instead, ldb function calls are processed immediately by the ldb library, which does IO directly on the database, while allowing multiple readers/writers using operating system byte range locks. and the way that gives you an API with very low overheads β often resulting in speeds of more than 10x what can be achieved with a more traditional LDAP architecture. ten times. TEN. that's not a glow-up, that's a glow-up π
in a taxonomy of databases, ldb would sit half way between key/value pair databases (such as berkeley db or tdb) and a full LDAP database. like, she's in her in-between era and she's thriving. with a structured attribute oriented API like LDAP and good indexing capabilities, ldb can be used for quite sophisticated applications that need a light weight database, without the administrative overhead of a full LDAP installation. sophisticated and low-maintenance, the dream fr fr π
included with ldb are a number of useful command line tools for manipulating a ldb database. these tools are similar in style to the equivalent ldap command line tools π
in its default mode of operation with a tdb backend, ldb can also be seen as a "schema-less LDAP". by default ldb does not require a schema, which greatly reduces the complexity of getting started with ldb databases. no schema, no stress, no 47-page config file, we love to see it π as the complexity of you application grows you can take advantage of some of the optional schema-like attributes that ldb offers, or you can migrate to using the full LDAP api while keeping your exiting ldb code. (yes, "exiting" β that's the original's typo, not mine, and I will not be correcting her, she's doing great π₯°) so you can level up whenever, and your existing code comes with you. no cap.
if you are new to ldb, then I suggest starting with the manual pages for ldbsearch(1) and ldbedit(1), and experimenting with a local database. then I suggest you look at the ldb_connect(3) and ldb_search(3) manual pages. that's the starter pack bestie, go play πΈ
π οΈ TOOLS π οΈ
the little command-line besties that come with her:
ldbsearch(1)β command lineldbsearch utility πldbedit(1)β edit all or part of aldbdatabase using your favourite editor βοΈldbadd(1)β add records to aldbdatabase using LDIF formatted input βldbdel(1)β delete records from aldbdatabase ποΈldbmodify(1)β modify records in aldbdatabase using LDIF formatted input π§
π FUNCTIONS π
the whole function family, and yes, every single one of them is here, I'm not skipping a single cousin at this reunion:
ldb_connect(3)β connect to aldbbackend πldb_search(3)β perform a database search πldb_add(3)β add a record to the database βldb_delete(3)β delete a record from the database ποΈldb_modify(3)β modify a record in the database π§ldb_errstring(3)β retrieve extended error information from the last operation π¨ldb_ldif_write(3)β write a LDIF formatted message πldb_ldif_write_file(3)β write a LDIF formatted message to a file πldb_ldif_read(3)β read a LDIF formatted message πldb_ldif_read_free(3)β free the result of aldb_ldif_read()π§Ήldb_ldif_read_file(3)β read a LDIF message from a file πldb_ldif_read_string(3)β read a LDIF message from a string π§΅ldb_msg_find_element(3)β find an element in aldb_messageπldb_val_equal_exact(3)β compare twoldb_valstructures βοΈldb_msg_find_val(3)β find an element by value πldb_msg_add_empty(3)β add an empty message element to aldb_messageπ«ldb_msg_add(3)β add a non-empty message element to aldb_messageπ¦ldb_msg_element_compare(3)β compare twoldb_message_elementstructures πldb_msg_find_int(3)β return an integer value from aldb_messageπ’ldb_msg_find_uint(3)β return an unsigned integer value from aldb_messageπ’ldb_msg_find_double(3)β return a double value from aldb_messageπ’ldb_msg_find_string(3)β return a string value from aldb_messageπ€ldb_set_alloc(3)β set the memory allocation function to be used byldbπ§ldb_set_debug(3)β set a debug handler to be used byldbπldb_set_debug_stderr(3)β set a debug handler for stderr output π₯οΈ
πΏ ENVIRONMENT VARIABLES πΏ
the ones that change her behaviour behind the scenes:
LDB_URLβ connect to the provided URL (cmdline tools only)LDB_MODULES_PATHβ path where to loadldbmodules fromLDB_MODULES_ENABLE_DEEPBINDβ enableRTLD_DEEPBINDwhen loadingldbmodules
π AUTHOR π
ldb was written by Andrew Tridgell[1]. absolute legend behaviour, we stan π
if you wish to report a problem or make a suggestion then please see the http://ldb.samba.org/ web site for current contact and maintainer information. they want to hear from you, fr fr π«Ά
ldb is released under the GNU Lesser General Public License version 2 or later. please see the file COPYING for license details. legal but make it slay πβ¨
π¦ NOTES π¦
- Andrew Tridgell
https://www.samba.org/~tridge/
and that's the whole page bestie!! this was LDB 1.1, dated 09/09/2026, from the System Administration tools section of the manual β mwah, go forth and query something πππ¦
π¦ where this page comes from
- fedora 44: libldb-devel 2:4.24.7-1.fc44 Β· LGPL-3.0-or-later
- fedora 44: libldb-devel 2:4.24.7-1.fc44 Β· LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms