Subject Re: Firebird 2.0 embedded backups - Success!
Author caldermd
More details... I did include a username and password. The command I
am executing is more like...
gbak.exe -b "C:\Documents and Settings\All Users\Application
Data\MyDB.FDB" "C:\Documents and Settings\All Users\Application
Data\MyDB_todays-date.FBK" -user sysdba -pass masterkey

--- In firebird-support@yahoogroups.com, "caldermd" <caldermd@...> wrote:
>
> You are correct, I was running gbak from a "Maintenance" subdirectory
> of my application, so it was using a non-embedded fbclient.dll while
> my main application was using an embedded fbclient.dll.
>
> I copied fbembed.dll into my "Maintenance" directory where gbak was
> and renamed it to fbclient.dll. It worked this way, but I have now
> restructured the program to keep all dll files in the main directory.
> It's a little cluttered, but easier to manage.
>
> My final solution:
> * The app is at C:\Program Files\MyApp\MyApp.exe
> * The database is at C:\Documents and Settings\All Users\Application
> Data\MyApp\MyDB.FDB
> * gbak.exe is now at C:\Program Files\MyApp\gbak.exe
>
> I am using the .NET 2.0 firebird client, to insure all connections are
> dropped, I run...
> FirebirdSql.Data.FirebirdClient.FbConnection.ClearAllPools();
> I then execute the backup as follows
>
> gbak.exe -b "C:\Documents and Settings\All Users\Application
> Data\MyDB.FDB" "C:\Documents and Settings\All Users\Application
> Data\MyDB_todays-date.FBK"
>
> As a note for other .NET 2.0 programmers referencing this, please use
>
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
> instead of the hard-coded path in the database and backup filenames.
>
> Thanks for the help!
>
>
> --- In firebird-support@yahoogroups.com, Helen Borrie <helebor@> wrote:
> >
> > At 08:16 AM 5/04/2007, you wrote:
> > >I am trying to use gbak or nbackup(preferred) to do a backup of a
> > >firebird 2.0 database which is embedded.
> > >
> > >gbak -b myDB.fdb myDB.fbk //fails "unavailable server"
> > >gbak -b myDB.fdb myDB.fbk -user sysdba -pass masterkey //fails
> > >"unavailable server"
> >
> > As with any embedded setup, the application and the embedded library
> > have to be in the same folder. I suspect you have gbak in the /bin
> > directory or somewhere else altogether, since the error message tells
> > you that gbak isn't finding a running server (which it won't, if it
> > can't find fbembed.dll, renamed as fbclient.dll).
> >
> > Tip: keep a dedicated application folder for running any of
> > Firebird's command-line tools.
> >
> > And don't try to run anything under the embedded server if something
> > else already has a connection to the database in question.
> >
> > If you want to do hot backups from your application, write a routine
> > using the Services API.
> >
> > >The same is true of nbackup.
> >
> > I don't *think* you can use nBackup with the embedded model, at least
> > not while anything else is active. nBackup isn't supported in the
> > Services API, either.
> >
> >
> > >On my development machine, I have a classic/superserver (for
> > >convenience). If I use the control panel applet to start the server,
> > >the second command shown above will succeed. If I stop the
server, it
> > >fails again.
> >
> > Of course. Both gbak and nBackup are client applications. They
> > don't work if there is not a running server.
> >
> > >The intended deployment of this will be an embedded server. I do not
> > >want to install a real server on the target computers.
> >
> > Then do some work: implement backup capability in your own
> > application code and provide a user-friendly interface. That way
> > your users won't bump into the situation of attempting to run a
> > command-line backup and being unable to do so because they are
> > working in the app.
> >
> > ./heLen
> >
>