Friday, October 10, 2008

Installing and libdbi layer for c api and libdbi-driver for firebird

I wish firebird was more simpler to use similar to dbi api for example that i use in perl world

You can see more about libdbi C api in the bacula manual


The according to libdbi (http://libdbi.sourceforge.net/) project:
libdbi implements a database-independent abstraction layer in C,
similar to the DBI/DBD layer in Perl. Writing one generic set of code,
programmers can leverage the power of multiple databases and multiple
simultaneous database connections by using this framework.

Here is how the Firebird libdbi driver is implemented and you can see how the layer is made over the standard
firebird api

sudo apt-get install libostyle-dev libfbembed2.1 firebird2.1-dev

wget http://heanet.dl.sourceforge.net/sourceforge/libdbi/libdbi-0.8.3.tar.gz
tar -zxvf libdbi-0.8.3.tar.gz
cd libdbi-0.8.3/
./configure --prefix=/usr
make
sudo make install
cd ..


wget http://heanet.dl.sourceforge.net/sourceforge/libdbi-drivers/libdbi-drivers-0.8.3-1.tar.gz
tar -zxvf libdbi-drivers-0.8.3-1.tar.gz
cd libdbi-drivers-0.8.3-1/
./configure --with-firebird --with-firebird-dir=/usr --prefix=/usr --disable-docs


make
sudo make install
make check
libdbi-drivers test program: $Id: test_dbi.c,v 1.46 2008/02/06 16:22:44 mhoenicka Exp $
Library version: libdbi v0.8.3

libdbi driver directory? [/usr/lib/dbd]
1 drivers available: firebird
test which driver? firebird

database administrator name? SYSDBA

database administrator password? masterkey
database directory? [.] /var/lib/firebird/2.1/data

database hostname? [(blank for local socket if possible)]
database name? [libdbitest]

Driver information:
-------------------
Name: firebird
Filename: /usr/lib/dbd/libdbdfirebird.so
Desc: Firebird/Interbase database support
Maintainer: Christian M. Stamgren
URL: http://libdbi-drivers.sourceforge.net
Version: dbd_firebird v0.8.3-1
Compiled: Oct 10 2008
Use CONNECT or CREATE DATABASE to specify a database
CREATE DATABASE '/var/lib/firebird/2.1/data/libdbitest';

...

No comments: