# Database Independent Abstraction Layer for C

## Introduction

### Description

libdbi provides application developers with a database independent abstraction layer for C. It handles the database-specific implementations for each type of database, so that you can use the same exact code with any type of database server that libdbi supports. You can initiate and use multiple database connections simultaneously, regardless of the types of database servers you are connecting to. The driver architecture allows for new database drivers to be easily added dynamically.

### libdbi Concepts and Terminology

In this guide, the terms user and programmer are used interchangably, since the target audience is the software developer using libdbi in his program. A star character (*) represents a wildcard matching any letters. For example, dbi_conn_* would represent all functions beginning with dbi_conn_.

Before doing anything useful, your program must initialize libdbi. This creates an instance of libdbi which is accessible through a handle. The libdbi architecture provides several drivers, one for each type of database server. All drivers are loaded into memory by each libdbi instance upon initialization and are made available to the programmer. Once a driver is instantiated, it represents a distinct database session and is called a connection.

### Modifications and redistribution of libdbi

libdbi is Copyright © 2001-2005, David Parker and Mark Tobenkin.

libdbi is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

### Contact Info

Please email us with any bugs, ideas, feature requests, or questions. The libdbi website has the latest version of this documentation and the libdbi software, as well as a central database of third-party drivers.

- &www;

- David Parker david@neongoat.com

- Mark Tobenkin mark@brentwoodradio.com

- Markus Hoenicka markus@mhoenicka.de

## Building and Installing libdbi

libdbi uses the "autotools", i.e. automake, autoconf, and libtool to provide a simple and consistend build and install process on all supported platforms. The good news is that you usually don't have to fiddle that much with `./configure` as libdbi provides only a single option:

`--disable-docs`

- If you build libdbi from a tarball, the docs are already prebuilt and ready to install. In this case, you don't need this option. However, if you build from a cvs checkout, this is a simple way to switch off building the documentation. This is useful if you don't want to install the prerequisites for building the docs (openjade, the DocBook DSSSL stylesheets, TeX, and JadeTeX).

If you type `./configure --help`, you'll see a few more options. These are provided by the autotools, and you should consult their documentation to make best use of them.

Once you have figured out which options to use or not, you are ready to go ahead and run:

          $ ./configure [your options]
          $ make
          $ sudo make install

## libdbi in a Nutshell (Quickstart Guide)

&libdbi-quickstart; &example-program;

## Error Handling

&libdbi-errorhandling;

## Transactions and Savepoints

&libdbi-transactions;

## Library and Interface Versions

&libdbi-versioning;
&libdbi-reference; &freedoc-license;