Need a flat DB? Use TDB!
No, do not use gdbm. Probably not bdb either.
TDB allows for concurrent writes. So, if you want to store some data in a file in your application/tool/command/whatever, and there is a chance that you need concurrent writes... TDB is really the only reasonable choice I know.
You can even have distributed TDBs.
I found out about TDB while writing a persistant cache for a little tool (a qmail plugin). Since by its nature it would have concurrent writes all the time, I was aiming for something like memcached, or its disk-based version... but TDB solves the problem nicely and effortlessly.
So, if you need a flat DB (a.k.a anonymous blobs with a single index, a.k.a a hash in a file)...
You could also try QDBM http://qdbm.sourceforge.net/
It's fast and has different interfaces depending on what you need. Like a GDBM-like interface, or a transactional interface.
A quick look st the docs show QDBM allows only one writer connection.
I'm sure you know who authored tdb (Andrew Tridgell, how is also the Samba and rsync developer lead)?
Did you have a look into "ldb" as well?
ldb is (c) by tridge too -- and it adds a really lightweight LDAP-like API to tdb, so you can have LDAP-like features for tdb without the overhead of a real LDAP server. "embedded LDAP" if you like...
AFAIK, a while ago Aaron Seigo has looked into utilizing tdb in KDE4 for storing settings... but I'm not up to date what his final findings are.
Cheers,
Kurt