Driver options

sqlite driver manual: A libdbi driver using the SQLite embedded database engine
Prev |  | Next

# Chapter 3. Driver options

Your application has to initialize libdbi drivers by setting some driver options with the `dbi_conn_set_option()` and the `dbi_conn_set_option_numeric()` library functions. The sqlite driver supports the following options:

dbname

  The name of the database you want to work with. As a SQLite database corresponds to one file in your filesystem, `dbname` can be any legal filename. If the database/file doesn't exist when you first try to access it, SQLite will create it on the fly.

  It is important to understand that the full path of the database is composed of `sqlite_dbdir` and `dbname`. Therefore `dbname` should not contain the full path of a file, but just the name.

sqlite_dbdir

  This is the directory that contains all sqlite databases. Use the full path please. If this option is not specified, a compile-time default directory will be used. By default, this directory (usually `/usr/local/var/lib/libdbi/sqlite`) has read and write permissions for everyone with the sticky bit set. If this is not suitable for your application, use a custom directory with your preferred permissions instead.

  > Note: It is necessary to keep all sqlite databases in one directory to make it possible to list all existing databases through the libdbi API. However, you are free to open more than one connection simultaneously, each one using a different setting of `sqlite_dbdir`.

timeout (numeric)

  The connection timeout in seconds.

sqlite_timeout (numeric)

  The design of SQLite does not allow concurrent access by two clients. However, if the timeout is larger than zero, the second client will wait for the given amount of time for the first client to release its lock. If the timeout is set to zero, the second client will return immediately, indicating a busy status. The numerical value of this option specifies the timeout in milliseconds.

  > Note: This option is deprecated. Use the generic option `timeout` instead. In the current implementation, `sqlite_timeout` overrides `timeout` if both are set. Please be aware that these options use different time scales.

Prev | Home | Next
Build and install the sqlite driver |  | Peculiarities you should know about