Database Independent Abstraction Layer for C: libdbi Driver Author's Guide
Prev | Chapter 2. Driver Infrastructure | Next

# 2.2. Database directories

Many database engines use database directories which they manage themselves. Other engines, like sqlite, sqlite3, or firebird, allow the database user to store database files basically anywhere on the filesystem. Drivers of such engines should follow some guidelines to make database operations as transparent as possible across all drivers. In order to allow e.g. listing available databases, most applications should keep all databases managed by such a driver in the same directory.

## 2.2.1. Default Database Directories

libdbi-drivers uses a common root directory (`<localstatedir>/lib/libdbi`) containing homonymous subdirectories for each driver as a default database path. If nothing else is specified (see Section 2.2.2), databases will be created and accessed in these subdirectories. Using different subdirectories for each driver makes switching between drivers painless without having to re-create database files from scratch.

Users can change the compile-time default root directory using the `--with-dbi-dbdir` option when configuring libdbi-drivers.

## 2.2.2. Custom Database Directories

In order to allow applications to store databases outside of the default directory if desired, a driver should implement a <drivername>_dbdir option which overrides the default database path in a connection.

Prev | Home | Next
Driver Capabilities | Up | Driver data