How to set up Firebird embedded with C++?

586 Views Asked by At

I'm trying to set up a Firebird embedded server for a simple C++ application that I'm making. It'll use one .fdb file that's intended to be only used by the application, but I want to be able to move the application and the database file around between PCs.

How do I set this up? There is a surprisingly little number of Firebird C++ tutorials that take the 'embedded' part into account, and I don't know how to set up the code (which files to use in my project, which includes to #include, which code to use to start a connection).

1

There are 1 best solutions below

0
On

Using Firebird Embedded in your C++ code works exactly the same as using the Firebird client library to connect to a remote Firebird server. The only differences are:

  • (Firebird 2.5 and earlier) Use fbembed.dll/libfbembed.so instead of fbclient.dll/libfbclient.so.
  • (Firebird 3) In addition to fbclient/dll/libfbclient.so, you need additional supporting files for Firebird Embedded (a.o. plugins/engine12.dll/plugins/libengine12.so); for example, see Jaybird with Firebird embedded example for a list of files you need for Firebird 3 Embedded on Windows
  • Instead of a connection string including a hostname, you only specify the path to the database file.

In other words, if you have a tutorial for using Firebird from C++, you can follow it for connecting it to Firebird Embedded as well.