Navigating a Firebird Database Version Upgrade Journey

Viktoria Bors-Pajuste - Jan 10 - - Dev Community

Prewords:

Greetings from a junior developer in Denmark! I've been immersed in the world of legacy code using Delphi, and over the past eight months, our application has undergone a significant transformation. We've bid farewell to Borland Delphi 2005 and Firebird database 1.5, welcoming the new era with Delphi 11 Alexandria and Firebird version 4.0.

Introduction – What is Firebird:

In the dynamic realm of relational database management systems (RDBMS), Firebird stands tall as an open-source, cross-platform solution for managing and storing data. Renowned for its reliability, performance, and scalability, Firebird has become a trusted companion for developers across diverse applications.

A standout feature of Firebird is its multi-generational architecture, allowing multiple versions of a record to coexist in the database. This not only facilitates efficient handling of concurrent transactions but also ensures a high level of isolation between them.

Step-by-Step Upgrade of the security.fdb File:

Embarking on a version upgrade journey involves more than a simple copy-paste, especially when it comes to the security database. Here's a step-by-step guide on how we tackled the challenge:

  • Make a Backup of Your Database Under the Older Version:

cd ToFolder
gbak -b -user USERNAME -password PASSWORD FilePath FilePath/NewFileName

  • Copy the Original Security Database and Create a Backup:

  • Stop Firebird Services:

net stop FirebirdServerDefaultInstance (or whatever you named your FB service)

  • Install Firebird 2.5 and Start It with Its Original Security Database

  • Restore Your Own Security Database Under the New Firebird:

cd to Folder
gbak -c -user USERNAME -password PASSWORD FilePath FilePath/NewFileName

  • Run security_database.sql on It

isql -user USER -password PASSWORD CONNECT FilePath INPUT FilePathSQL
EXIT

  • Stop Firebird Service and Replace with Your Own Security Database

  • Start the Service Again and Restore Your Own Database

Now, you've moved from Firebird 1.5 to 2.5

Moving from Firebird 2.5 to 4.0 introduces its own set of challenges. Firebird 3 and beyond come with a new authentication model, meaning no predefined users in the security database. Here are the modified steps:

  • Manually Add Users to the Security Database

isql -user sysdba employee
SQL> create user USER password PASSWORD;
SQL> exit;

Fortunately, the Firebird webpage provides a great resources and articles about upgrading versions, offering valuable insights and assistance throughout the process. Check it out here.

And now, a new set of challenges arises—meticulously reviewing all SQL queries and database-related functions. As the database engine evolves, so do its queries and functions. This phase demands a thorough examination and potential updates to ensure compatibility with the latest enhancements and optimizations. Embracing the evolution of the database engine ensures that your application not only benefits from the latest features but also maintains peak performance and efficiency. Happy coding!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .