-3

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

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • Embedded - is not FB source code inside your application. Embedded - for Firebird 2.x - means you put different DLL (fbembed.dll about 3MB size plus auxillary libs like ICU) instead of that usual thin network proxy (fbclient.dll about 800KB). Then your application works mostly the same as with stand-alone server (no user securety, less data safety, but generally the same). It is more flexible but also more complex on UNIX or with FB3. – Arioch 'The Feb 01 '21 at 09:13
  • @Arioch'The Ah okay, I see. I should probably reconsider if I want to use FB then. If I were to follow a standard tutorial on how to connect to a FB server via my program's code, would I need to change the code in some way in order to take into account that I'm working with the embedded version of FB? – INEEDANSWERS Feb 01 '21 at 10:06
  • I can't say much of FB/3 or UNIX - they got more flexible and complex. I can only say about Windows FB 2.5 - you get fb embed zip and unpack it into your app folder. Then you either make your application use fbEmbed.dll instead of fbClient.dll (if your language libs provides it) or rename fbEmbed into fbClient - if you do not explicitly rely on multiple connections interacting or different roles/users having restricted rights - then for single connection it seems to be no difference. OTOH, indeed, why not SQLite, which is much more common for embedded? – Arioch 'The Feb 01 '21 at 13:58
  • Granted, it can be exactly the scale-up way, from single-user to multi-user client-server, from embedded to stand-alone. If such scaling-up is in plans. For SQLite as backend stage you then would have to make an intermediate "app-server" tier. Whether it matters or not for you is you own fortunetelling. – Arioch 'The Feb 01 '21 at 14:00

1 Answers1

1

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.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197