Database management systems are sufficient for many kinds of projects. Of course, they abound with MySQL / MariaDB or PostgreSQL popular but there are also other very good and efficient ones like SQLite or Firebird. The latter is less known but equally efficient and sophisticated. Of course, its operation is more similar to SQLite than to the very robust MySQL / MariaDB. So in this post, I will show you how to install Firebird on Ubuntu 20.04 / 18.04.
Firebird is a relational database management system written in C++, open
On the other hand, some of the features of the application are the following:
- It is scalable
- Support the Client/Server architecture by TCP protocol.
- Many drivers are available for various programming languages such as PHP, Java or C++.
- Quite secure in user management.
- Cross-platform. With installable binaries for Windows, Linux, BSD, Solaris,
So I will teach you how to install it and we will take the opportunity to do some small tests with the application.
Install Firebird on Ubuntu 20.04 / 18.04
The version that is available in the official Ubuntu 18.04 repositories
In the case of Ubuntu 20.04 already Firebird 3 is in the official repositories. That is, nothing needs to be added.
Only for Ubuntu 18.04:
Fortunately, we have a dedicated repository for Ubuntu 18.04, so let us get to work.
Open a terminal session or connect to your server using SSH and add the repository.
:~$ sudo add-apt-repository ppa:mapopa/firebird3.0
After it is added. Refresh the APT cache and install the necessary packages:
:~$ sudo apt update
For Ubuntu 20.04 / 18.04:
:~$ sudo apt firebird3.0-server
During installation, you will be informed that the default user is “SYSDBA”. Define a password for this main user. It has to be quite secure.
Once you have defined the password. All you have to do is reconfigure the package so that all the changes are properly applied.
:~$ sudo dpkg-reconfigure firebird3.0-server
And it is ready to use.
Working with Firebird on Ubuntu 20.04 / 18.04
To enter the Firebird administration console and start using commands, just execute:
:~$ sudo isql-fb
With this we will be able to execute commands. And to get out just use this other one:
Before starting to create databases and tables, it is necessary to talk about one thing. Firebird can store and access your databases from anywhere SQLite style, but can also restrict the location of them.
To make it accessible from anywhere or from a specific directory, just edit its configuration file:
:~$ sudo nano /etc/firebird/3.0/firebird.conf
Leave it as it is in the image to allow access to the database from any directory. There you can set a restriction to a particular directory.
Save the changes and close the file. Then, to apply the changes, just restart the service.
:~$ sudo systemctl restart firebird3.0
Creating databases and tables
Now we can start creating new databases and tables.
First we connect again to the Firebird shell.
:~$ sudo isql-fb
And then, we proceed to create the new database with the following syntax:
:> create database ["database_path.fdb"] user ['user']password '[password]';
:> create database "/var/lib/firebird/3.0/data/first_database.fdb" user 'SYSDBA' password 'angelo123';
Then, to use it or rather to connect to it we use this other command:
:> connect "/var/lib/firebird/3.0/data/first_database.fdb" user 'SYSDBA' password 'angelo123';
Now we’re ready to start creating tables.
For this example I will create a table with only two fields.
:> CREATE TABLE STUDENT (ID INT NOT NULL PRIMARY KEY, NAME VARCHAR(25));
So, you can show all the tables by using this command:
:> show tables;
Now, I am going to insert some data. Just use the following command:
:> INSERT INTO STUDENT VALUES (1, 'Angelo');
And get the data:
:> select * from STUDENT;
As you can see being SQL language, the commands and operations are similar to MySQL / MariaDB and PostgreSQL.
Finally, you can show the installed version:
:> show version;
And that is it.
Firebird may not be popular but is considered by many projects for its efficiency. Being of the SQL family its commands are not so different from those of other better known programs such as MySQL or MariaDB. So we only have to work with it.
Share this post and join our Telegram Channel.