Click to See Complete Forum and Search --> : ADO and NT Service


Alex Black
May 14th, 1999, 08:39 PM
Anyone used ADO with an NT Service?

This code fails when I run it as a service:


_ConnectionPtr db;
hCreate = db.CreateInstance( __uuidof(Connection) );




Any ideas?

Bob Place
May 24th, 1999, 07:46 AM
Have you turned on OLE with:

// Initialize OLE.
::CoInitialize(NULL);

Bob

brevert
May 24th, 1999, 08:52 PM
Remember that a service starts without an active user on the box, so if your service talks to a database that requires authentication (like SQL Server) you must supply a valid NT user account to the service when it starts. Go to Services and under the Startup settings for your service, set "Log On As:" to "This Account" and supply an NT user account and password that is authorized to access your database.

May 28th, 1999, 10:38 AM
Yes I hav used with NT and it works fine. Make sure you have initialized OLE by CoInitialize();
mahesh

Yogen M
May 31st, 1999, 12:54 AM
If there are other services that your service uses (e.g. MSSQL service) then they should
be started first. CreateService(or whatever...) takes a list of dependent services.

saravana_s
May 19th, 2000, 12:45 PM
Can you send me the code?