Subject Re: Multithread aplication with embedded server
Author carlos_ochotorena
The application can run:

As a Service. In this case it will not use the embedded server but
the full server.
As a standard windows application. In this case it will run with
either the embedded server or the full server.

I don't have any problem running a backup while I am running the
standard windows application, but when running the windows service
(with the full server) I receive the "Cannot attach to services
manager"

The exe is the same, we use a command line parameter to select if we
want it to run as a standard app or as a service (of course when
running as a service, it must be launched using the windows Service
APIS)

I have found a question similar to mine in the Internet, but I am
not abble to find any answer for it. :-(


--- In firebird-support@yahoogroups.com, "Alan McDonald" <alan@...>
wrote:
>
> > The error I am getting is "Cannot attach to services manager"
> > It only happens when I am running my app as a service. When it is
> > running as a standard application it works properly.
>
> your app as a service?
> you'd better tell us more about the architecture now....
>
> you have a service application which uses the embedded server..
YES?
>
> I suspect that your appplication running as a service will need to
use the
> TP stack ..
> Alan
>
>
> >
> > The code I am using is:
> >
> > BackupService := TIBBackupService.Create(nil);
> >
> > try
> > with BackupService do
> > begin
> > ServerName := ConnectionData.ServerName;
> > LoginPrompt := False;
> > Params.Add(Format('user_name=%s',
[ConnectionData.UserName]));
> > Params.Add(Format('password=%s',
[ConnectionData.Password]));
> > Active := True;
> > try
> > Verbose := False;
> > Options := [NonTransportable, IgnoreLimbo];
> > DatabaseName := ConnectionData.DatabaseName;
> > BackupFile.Add(BackupFileName);
> >
> > ServiceStart;
> > while not eof do
> > sleep(500);
> > finally
> > Active := False;
> > end;
> > end;
> > finally
> > BackupService.Free;
> > end;
> >
> >
> > And the error is raised when the "Active := True" line is
executed.
> > The application is connected as SYSDBA to the database and all
the
> > other tasks work properly
> >
>