Page 1 of 1

TZConnection, ADO and TService

Posted: 04.01.2006, 13:56
by marco.giacinti
it's happening something strange:
I created a service (TService class) and a form created by this service; the form has two TZConnection, one with MySQL and the other with ADO via ODBC. OK, if I try to use both the connections in a Win32 application everything is ok, but is I try to use the ado TZConnection in the service, this service won't do his work :(
Can somebody help me?
Sorry for my poor English :roll:

Posted: 04.01.2006, 14:27
by marco.giacinti
I can tell you something more: if I try to connect using the ado provider in the TZConnection while developing inside delphi (so I turn Connected to true) everything works and I'm able (for example) to use TZTable to view columns.

If I start the service I find an error in the Event Viewer saying
"Impossibile trovare la descrizione dell'ID evento ( 0 ) nell'origine ( Fax.exe ). Il computer locale potrebbe non disporre delle necessarie informazioni nel Registro di sistema o dei file DLL necessari per visualizzare messaggi da un computer remoto."
In english (bad english):
"unable to find description for event ID (0) in file (Fax.exe). Local pc couldn't have necessary informations in system Registry or necessary DLLs to show messages from a remote pc".

Again: if I try the connection inside IDE it works; if I try the connection inside a Win32 exe it works; it doesn't work only running the Win32 service
:cry:
What's wrong? Please help me !!!

Posted: 04.01.2006, 18:23
by MarkusD
Hello marco,

as your error message already states you don't have all necessary rights to access some registry key(s). Services run normally under the System account and don't have full access to HKLM and no HKCU. Imho you have two options:

1. Try to find out what registry keys are the problem ( e.g. regmon) and assign the appropriate rights to the system account. Perhaps you could try to run the service with a new restricted user to create the problem inside Delphi. Or try to start the service in Delphi with the system account ( e.g.: runas but don't know if this works with system account or ServiceStartName, Password properties of the TSerivce).

2. Install the service so that it runs under an existing account ( WinXP: Login = second tab in properties pagecontrol of your service), which has the neccessary rights.

Best Regards,
Markus Dütting

Posted: 05.01.2006, 08:43
by marco.giacinti
It seemed a great idea to run service with administrator account, I didn't think about it before.
OK, I tried, but unsuccesfully :(
The strange stuff is that this happens only with ado connection, even trying not to use odbc but a direct access to a database.

Running as administrator I have this new part in the error in event manager: il processo di servizio non ha poruto connettersi al controller di servizio".
In my bad english: "service process wasn't able to connect to service controller".
Logging service operations I saw the error happens trying to open ado connection.
I don't know what to do honestly.

As a workaround I wrote an application which can't be closed and that doesn't appear in taskbar... but it's not the same :(