Erro em codigo de Backup

Delphi

Firebird

11/03/2016

ola amigos estou implementando um código de backup e fiz o codigo abaixo:


procedure TfrmBackRest.SpeedButton3Click(Sender: TObject);
begin
begin
with IBBackupService1 do
begin
ServerName := 'Local Server';
LoginPrompt := False;
Params.Add('user_name=SYSDBA');
Params.Add('password=masterkey');
Active := True;
Verbose := True;
DatabaseName := Edit1.Text;
BackupFile.Add(DirectoryListBox1.Directory + '\' + Edit3.Text);
Options := [];
if cbxIgnoreChecksums.Checked then
Options := Options + [IgnoreChecksums];
if cbxIgnoreLimbo.Checked then
Options := Options + [IgnoreLimbo];
if cbxNoGarbageCollection.Checked then
Options := Options + [NoGarbageCollection];
if cbxNonTransportable.Checked then
Options := Options + [NonTransportable];
ServiceStart;
while not eof do
Memo1.Lines.Add(GetNextLine);
ShowMessage('Backup Efetuado com Sucesso');
end;
end;
end;

e dá o seguinte erro na hora que eu clico gravar: unable to complete network to host "Local Server". failed to locate host machine
Thiago Santos

Thiago Santos

Curtidas 0

Respostas

Natanael Ferreira

Natanael Ferreira

11/03/2016

Experimente trocar "Local Server" por "localhost":

procedure TfrmBackRest.SpeedButton3Click(Sender: TObject);
begin
  with IBBackupService1 do
  begin
    ServerName := 'localhost';
    LoginPrompt := False;
    Params.Add('user_name=SYSDBA');
    Params.Add('password=masterkey');
    Active := True;
    Verbose := True;
    DatabaseName := Edit1.Text;
    BackupFile.Add(DirectoryListBox1.Directory + '\' + Edit3.Text);
    Options := [];
    if cbxIgnoreChecksums.Checked then
      Options := Options + [IgnoreChecksums];
    if cbxIgnoreLimbo.Checked then
      Options := Options + [IgnoreLimbo];
    if cbxNoGarbageCollection.Checked then
      Options := Options + [NoGarbageCollection];
    if cbxNonTransportable.Checked then
      Options := Options + [NonTransportable];
    ServiceStart;
    while not eof do
      Memo1.Lines.Add(GetNextLine);
    ShowMessage('Backup Efetuado com Sucesso');
  end;
end;
GOSTEI 0
Thiago Santos

Thiago Santos

11/03/2016

agora aparece outro erro:

cannot open backup file C:\SConsult\Fontes\Back_Rest\
unknown ISC error 336330835

me ajudem ai por favor
GOSTEI 0
Natanael Ferreira

Natanael Ferreira

11/03/2016

cannot open backup file C:\SConsult\Fontes\Back_Rest\
unknown ISC error 336330835


De acordo com a mensagem de erro, não pode abrir o arquivo no caminho:
C:\SConsult\Fontes\Back_Rest\

Creio que na concatenação no seu código faltou completar o caminho com o nome do arquivo.

Exemplo:
C:\SConsult\Fontes\Back_Rest\SeuBanco.gdb
GOSTEI 0
Thiago Santos

Thiago Santos

11/03/2016

mas eu busco o banco de dados que está em outra pasta chamada bd\consultorio.fdb

ai eu tento enviar ele para dentro dessa pasta back_rest

mas da esse erro
GOSTEI 0
POSTAR