Subject Re: [firebird-support] embedded FB and backup
Author Urs Liska
Alan McDonald schrieb:
>>Dear All,
>>
>>I am deploying an application with the embedded Firebird server and
>>want to provide backup facilities for the users, ideally
>>programmatically from within the app (Delphi 7).
>>
>>I tried to execute GBAK using the ShellExecute command but it always
>>returns error 2. This approach works fine with a separate program
>>whose only purpose is to ShellExecute the GBAK, but I would rather do
>>a silent backup every time my main app closes.
>>
>>My temporary solution is to use FileCopy to create a copy of the
>>DATABASE.FDB file on the hoof.
You shouldn't do any file operations on a database file - at least if
you cannot be absolutely sure that there isn't any firebird server using
the file anymore (might as well doing something after the last client
has disconnected)
>>
>>Am I missing something? Can GBAK work at all with the embedded server?
>>Or is the problem that the embedded server will not support my app AND
>>GBAK at the same time? What's the neatest way to give users a backup
>>feature from within the the app?
>>
>>TIA,
>>
>>Rob
>
>
> for the embedded app - you need to use the embedded server's services API to
> backup. If your app is running and you execute gbak external to the app - it
> will be refused a connection. Your app must be closed before gbak can maek
> this separte connection.
I don't think this is true. Embedded server accepts only one connection
at a time.
So I think you can just close the connection and then run gbak from
within your app (which is probably also true when you use the services
API through IBO or another component set that supports services.
> OTOH - if your app uses IBO it can use the IBOAdmin components (IBX=IBAdmin)
> components to attache to the embedded server and run a backup.
> I also provide restore features which require. I have this all running
> seamlessly in my embedded app.
> Alan
>

HTH
Urs