Subject Re: [firebird-support] Embedded FB
Author Helen Borrie
At 06:42 AM 14/01/2011, munster77054 wrote:
>Hi all:
>
>Hope someone can give me some guidance. I'm working on a program for my wife, which eventually I will be releasing as freeware. Now, I can get the database compacted using gbak.exe just fine from "within" my program, using the full FB install. However, when I try the same thing with the embedded FB, I can't get it to work, even with all the necessary files within the application folder.
>
>Any ideas why the embedded FB won't let me compact?

and
>Forgot to mention, using 2.1.3.18185

1. Move a copy of gbak.exe and firebird.msg into your embedded application directory (both in the root dir of the app, not \bin).

2. Make sure fbembed.dll is renamed to fbclient.dll.

3. In your program, make sure
a) fbclient.dll is being loaded from the app directory and not from wherever you have the regular fbclient.dll
b) your application is not already connected to the database before you try to execute gbak.exe; or save yourself the agony and use the Services Manager.

The 3(b) problem goes away in v.2.5. However, regardless of version, don't make the fatal error of doing a -replace_database restore whilst anything else is connected.

Also be aware that gbak -backup runs in its own transaction. If the app is connected and working whilst the backup runs, a restore won't reflect any work that was uncommitted when the backup started.

Since you refer to gbak backup-and-restore as a "compacting" tool, I hope you are aware that, although gbak backup-and-restore *does* have the *effect* of compacting a database (usually), that's not its purpose. Firebird databases don't require "compacting" if applications are written to manage transactions properly. The engine re-uses the space on disk that is freed up by regular garbage collection, sweeps or, indeed, backups.

./heLen