Subject Programmatically using GBAK
Author jackmills75
I am trying to programmatically perform backup & restore with gbak
using CreateProcess().
For restore the user is given the option to overwrite the DB or
create new.

This is the backup statement passed to CreateProcess, all works well,
no errors
c:\Program Files\Firebird\Firebird_1_5\bin\gbak -b -v -user SYSDBA -
pas masterkey C:\Magus\FBDB\FRED.FDB C:\Magus\FBDB\FRED.FBK

This is the restore statement, I get the error as indicated below.
c:\Program Files\Firebird\Firebird_1_5\bin\gbak -r -v -user SYSDBA -
pas masterkey C:\Magus\FBDB\FRED.fbk C:\Magus\FBDB\FRED.fdb

I got this error adding the –y option
gbak: opened file C:\Magus\FBDB\FRED.fbk
gbak: ERROR: could not drop database C:\Magus\FBDB\FRED.fdb (database
might be in use)
gbak: Exiting before completion due to errors

If I run the above restore statement from the command prompt the
restore works ok (I captured the statement to a file & then copied &
pasted into the command prompt i.e no typing errors)

If I run the restore from my program using the –c option then a
restore is performed correctly.

The database is not active i.e. no connections

Any ideas what's going wrong?

Using Win2000 & C++ Builder 6 firebird ver 1.5 WI-V6 3.2.4731


Thanks for any help

Jack