Subject Firebird shutdown, backup & restore possible with IBX?
Author Mathias Burbach
Hello Folks!

I have created a datamodule to

* shutdown a Firebird database
* create a backup &
* restore the backup

using the IBX components (TIBConfigService, TIBBackupService &
TIBRestoreService). It all works fine if no user is connected at the
time the Firebird database is shut down. If any connection is still
active at the time of TIBConfigService.ShutdownDatabase the disconnect
is forced and the connection is lost (e.g. in IBExpert). When I then try
to restore the database with TIBRestoreService I can attach to the
server but as soon as I call TIBRestoreService.ServiceStart I run into
an EIBClientError exception ("Cannot perform operation - service is not
attached") inside TIBControlService.InternalServiceStart when IBX is
calling FGDSLibrary.isc_service_start. If I use the same implementation
against an instance of InterBase 7.5 it all works fine.

I could accept if the admin components of IBX wouldn't work at all with
Firebird 1.5, but it seems to work *except* for the situation where the
database shutdown really needs to disconnect active Firebird
connections. Has anyone experienced a similar problem?

Here is my implementation:

procedure TdmoDBBackupRestore.BackupAndRestore(const ServerName,
DatabaseName, BackupFile: String);
begin
IBConfigService.ServerName := ServerName;
IBConfigService.DatabaseName := DatabaseName;
IBConfigService.Attach;
try
IBConfigService.ShutdownDatabase(Forced, 0);
try
Backup(ServerName, DatabaseName, BackupFile);
Restore(ServerName, DatabaseName, BackupFile);
finally
IBConfigService.BringDatabaseOnline;
end;
finally
IBConfigService.Detach;
end;
end;

procedure TdmoDBBackupRestore.Restore(const ServerName, DatabaseName,
BackupFile: String);
begin
IBRestoreService.ServerName := ServerName;
IBRestoreService.DatabaseName.Text := DatabaseName;
IBRestoreService.BackupFile.Text := BackupFile;
IBRestoreService.Attach;
try
IBRestoreService.ServiceStart;
while IBRestoreService.IsServiceRunning do
Sleep(100);
finally
IBRestoreService.Detach;
end;
end;

Thanks for a short answer in advance.

Salut,
Mathias