Since BerkeleyDB can use the SQLite API, can Python use the sqlite module to connect to BerkeleyDB?
This post suggests using something else, but could have been written pre-API sync: Best Python module for Berkeley DB?
Can get a simple connection string.
I am using Python 2.7 on Linux and Windows.
As suggested here https://forums.oracle.com/forums/thread.jspa?threadID=2302793 I've tried on linux x86_64 with python27, here the steps to make a static version since I doubt your distribution has bdb sqlite api.
Download db-5.2.36.tar.gz
tar xzvf db-5.2.36.tar.gz
cd db-5.2.36/build_unix/
CFLAGS="-fPIC" ../dist/configure --enable-static --disable-shared --enable-sql-compat
# you need -fPIC to build the python ext of pysqlite
make
make prefix=/tmp/bdb install
get a copy of pysqlite2 from http://code.google.com/p/pysqlite/, I've used an hg checkout. In setup.cfg add in build_ext section (there are yet two commented lines you can reuse them)
include_dirs=/tmp/bdb/include
library_dirs=/tmp/bdb/lib
then cd in pysqlite:
python setup.py build
python setup.py install
or without installing:
cd build/lib.linux-x86_64-2.7
python
from pysqlite2 import dbapi2
conn = dbapi2.connect('test.db')
c = conn.cursor()
c.execute('bla bla bla sql')