Firebird

From Segfault
Jump to: navigation, search

For some reason I needed a Firebird database installed. The setup routine for Ubuntu[1] worked good enough for Debian too.

Installation

sudo apt-get install firebird2.5-classic firebird2.5-examples

If the debconf priority was set too low, we'd have to configure the package ourselves:

$ sudo dpkg-reconfigure -p low -f text firebird2.5-classic
Enable Firebird server? yes

Password for SYSDBA: ****************

The database server won't start without an existing database, so let's use one of the example databases:

gzip -dc /usr/share/doc/firebird2.5-examples/examples/empbuild/employee.fdb.gz > employee.fdb
sudo firebird:firebird employee.fdb
sudo mv employee.fdb /var/lib/firebird/2.5/data/

Usage

With that in place, we can start to use the database now:

$ isql-fb 
Use CONNECT or CREATE DATABASE to specify a database
SQL> connect "localhost:/var/lib/firebird/2.5/data/employee.fdb" user 'SYSDBA' password '****************';
Database:  "localhost:/var/lib/firebird/2.5/data/employee.fdb", User: SYSDBA

SQL> show tables;
      COUNTRY                                CUSTOMER                       
      DEPARTMENT                             EMPLOYEE                       
      EMPLOYEE_PROJECT                       JOB                            
      PROJECT                                PROJ_DEPT_BUDGET               
      SALARY_HISTORY                         SALES                          

SQL> select rdb$get_context('SYSTEM', 'ENGINE_VERSION') from rdb$database;
RDB$GET_CONTEXT[2]
=============================================================================== 
2.5.2

SQL> show version;
ISQL Version: LI-V2.5.2.26540 Firebird 2.5
Server version:
Firebird/linux AMD64 (access method), version "LI-V2.5.2.26540 Firebird 2.5"
Firebird/linux AMD64 (remote server), version "LI-V2.5.2.26540 Firebird 2.5/tcp (wheezy0)/P12"
Firebird/linux AMD64 (remote interface), version "LI-V2.5.2.26540 Firebird 2.5/tcp (wheezy0)/P12"
on disk structure version 11.2

References

  1. Setting up Firebird on Ubuntu Linux
  2. RDB$GET_CONTEXT()