Subject | RE: [firebird-support] Programmatically backing up a database |
---|---|
Author | Daniel Raith |
Post date | 2004-05-10T18:14:51Z |
This is Delphi code, but you should get the idea.
procedure BackupGDB( AServerName, ADatabaseName, ABackupFile, AUserName,
APassword: String; AWait: Boolean; ABackupOptions: TBackupOptions = []
);
var
IBBackupService: TIBBackupService;
begin
IBBackupService := TIBBackupService.Create( nil );
try
IBBackupService.ServerName := AServerName;
IBBackupService.Protocol := TCP;
IBBackupService.Params.Add( 'user_name=' + AUserName );
IBBackupService.Params.Add( 'password=' + APassword );
IBBackupService.LoginPrompt := False;
IBBackupService.DatabaseName := ADatabaseName;
IBBackupService.BackupFile.Clear;
IBBackupService.BackupFile.Add( ABackupFile );
IBBackupService.Options := ABackupOptions;
IBBackupService.Attach;
IBBackupService.ServiceStart;
if AWait then
while IBBackupService.IsServiceRunning do
begin
Sleep( 5000 );
Application.ProcessMessages;
end;
IBBackupService.Detach;
finally
FreeAndNil( IBBackupService );
end;
end;
I'm using BCBv5 and FBv1.5 Embedded. I need to periodically backup
the database. I've tried to use the IBOAdmin components for
Delphi\BCB and plopped a TBackupService component on a form, but,
after looking through the headers, I cannot figure out what to call.
Can anyone shed some light on how these work?
Alternatively, can I just ship gbak.exe with my app and call it from
my application?
TIA
David
[Non-text portions of this message have been removed]
procedure BackupGDB( AServerName, ADatabaseName, ABackupFile, AUserName,
APassword: String; AWait: Boolean; ABackupOptions: TBackupOptions = []
);
var
IBBackupService: TIBBackupService;
begin
IBBackupService := TIBBackupService.Create( nil );
try
IBBackupService.ServerName := AServerName;
IBBackupService.Protocol := TCP;
IBBackupService.Params.Add( 'user_name=' + AUserName );
IBBackupService.Params.Add( 'password=' + APassword );
IBBackupService.LoginPrompt := False;
IBBackupService.DatabaseName := ADatabaseName;
IBBackupService.BackupFile.Clear;
IBBackupService.BackupFile.Add( ABackupFile );
IBBackupService.Options := ABackupOptions;
IBBackupService.Attach;
IBBackupService.ServiceStart;
if AWait then
while IBBackupService.IsServiceRunning do
begin
Sleep( 5000 );
Application.ProcessMessages;
end;
IBBackupService.Detach;
finally
FreeAndNil( IBBackupService );
end;
end;
I'm using BCBv5 and FBv1.5 Embedded. I need to periodically backup
the database. I've tried to use the IBOAdmin components for
Delphi\BCB and plopped a TBackupService component on a form, but,
after looking through the headers, I cannot figure out what to call.
Can anyone shed some light on how these work?
Alternatively, can I just ship gbak.exe with my app and call it from
my application?
TIA
David
[Non-text portions of this message have been removed]