Installing Firebird and node-firebird on the Raspberry Pi
The following steps describe how to install and test Firebird then node-firebird on the Raspberry Pi. You need to install Node.js before node-firebird. You should find this installation easier if you have worked through our Smart Pascal section on networking. The section covers the use of socket.io (that we also employ here for real-time updating of clients).
Type or copy the commands below at the prompt and accept any invitations to continue. When invited, set the sysdba password, to which we will refer as NEWPASS.
We have tried to include all the many necessary steps for a Debian OS on a Pi. Please inform us about anything that would make it easier for a student to succeed in this challenging but rewarding project. Our original instructions were for Firebird 2.5 Super and we have added commands for Firebird 3.0. To date we have been unable to access our Firebird 3.0 database using node-firebird, even after relaxing file permissions and following instructions to set AuthServer = Legacy_Auth and WireCrypt = Disabled in the firebird.conf file. See the following page for an entertaining workaround using WebSockets and, later in this tutorial a more straightforward approach using MySQL instead of Firebird.
- sudo apt-get install firebird2.5-super or sudo apt-get install firebird3.0
sudo dpkg-reconfigure firebird2.5-super or sudo dpkg-reconfigure firebird3.0
This command starts the Firebird server. We test using the database CONTRIBUTIONS.FDB which is in db_contributions.zip and can be created following our instructions for Windows on a PC. We found that we could not open CONTRIBUTIONS.FDB with Firebird 3.0 so we quickly prepared CONTRIBUTIONS_PI.FDB from scratch.
Copy CONTRIBUTIONS.FDB to the home folder and change directory if necessary to this folder.
If you would prefer to create a database on the Raspberry Pi rather than use ours, follow the instructions in the main Pascal database tutorial.
sudo chown firebird.firebird CONTRIBUTIONS.FDB
This gives the database the required ownership.
sudo mv CONTRIBUTIONS.FDB /var/lib/firebird/2.5/data or sudo mv CONTRIBUTIONS.FDB /var/lib/firebird/3.0/data
This moves the database to its expected location.
gsec -user sysdba -pass NEWPASS -add student -pw pp4s
This creates the user with name student and password pp4s.
isql-fb (or sudo isql-fb for Version 3.0)
This is the equivalent of isql in windows to obtain the Firebird prompt.
connect /var/lib/firebird/2.5/data/CONTRIBUTIONS.FDB user 'student' password 'pp4s'; or connect /var/lib/firebird/3.0/data/CONTRIBUTIONS.FDB user 'student' password 'pp4s';
Commands end with a semicolon.
- SELECT * from Programmer;
- npm install node-firebird
You should see confirmation that the server is running.
- To test thoroughly the server and set-up, work through a demo on the following page.