henryreynolds
asked on
TIBBackupService, cannot attach to service manager
Good day
I am trying to backup my database from Delphi, but I am getting the following error.
cannot attach to service manager.
I read in the help but I am not sure what service component I must add.
Thank you
Henry
I am trying to backup my database from Delphi, but I am getting the following error.
cannot attach to service manager.
I read in the help but I am not sure what service component I must add.
Thank you
Henry
var srvBackup : TIBBackupService;
lOptions : TBackupOptions;
begin
srvBackup := TIBBackupService.Create(nil);
srvBackup.Params.Clear;
Memo1.Clear;
Screen.Cursor := crHourGlass;
try
srvBackup.Active := true;
srvBackup.Attach();
lOptions := [];
if srvBackup.Active = true then
begin
with srvBackup do
begin
ServerName := 'localhost';
LoginPrompt := False;
Params.Add('user_name=sysdba');
Params.Add('password=masterkey');
BackupFile.Add('c:\Backup');
DatabaseName := 'c:\Databases\Database.fd2';
Verbose := true;
ServiceStart;
while not srvBackup.Eof do
begin
Application.ProcessMessages;
Memo1.Lines.Add(srvBackup.GetNextLine)
end;
end;
end;
finally
if srvBackup.Active then
srvBackup.Detach();
Screen.Cursor := crDefault;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What error do you get?
Machine := '' (Null) for your local machine. Do not put in \\Machine.
and Service := your service name...
and in the uses clause make sure you have
uses
WinSvc;
John
Machine := '' (Null) for your local machine. Do not put in \\Machine.
and Service := your service name...
and in the uses clause make sure you have
uses
WinSvc;
John
Are you still stuck?
John
John
ASKER
Hi John
I only got back at work today, but I think it is something todo with the protocol you must specify.
You can specify LOCAL, TCP or SPX.
I will let you know
I only got back at work today, but I think it is something todo with the protocol you must specify.
You can specify LOCAL, TCP or SPX.
I will let you know
Forced accept.
Computer101
EE Admin
Computer101
EE Admin
ASKER
Sorry but it does not work, it does not open the first service:
SVCManHandle := OpenSCManager('Machine', nil, SC_MANAGER_CONNECT);