Installing Firebird and node-firebird on the Raspberry Pi

We based this page on authoritative pages on Firebird on the Raspberry Pi and Node.js with Firebird.

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 (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.

  1. sudo apt-get install firebird2.5-super or sudo apt-get install firebird3.0
  2. 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 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.
  3. 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.
  4. sudo chown firebird.firebird CONTRIBUTIONS.FDB
    This gives the database the required ownership.
  5. 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.
  6. gsec -user sysdba -pass NEWPASS -add student -pw pp4s
    This creates the user with name student and password pp4s.
  7. isql-fb (or sudo isql-fb for Version 3.0)
    This is the equivalent of isql in windows to obtain the Firebird prompt.
  8. 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.
  9. SELECT * from Programmer;
  10. EXIT;
  11. Change directory to where you will be putting your JavaScript server. It should contain the folder node-modules and contents.
  12. npm install node-firebird
  13. To test, copy the JavaScript server code on the following page into a text file named FirebirdServer.js and save it to your chosen location (which must contain the node-modules folder and contents). Run it with the instruction node FirebirdServer.
    You should see confirmation that the server is running.
  14. To test thoroughly the server and set-up, work through a demo on the following page.
Programming - a skill for life!

How to use datasets and databases in Smart Pascal applications