Page 1 of 1

Problems access DB in services

Posted: Thu 18 Nov 2004 11:43
by Andy02
Hi all,
when I´m trying to open SQLConnection on app running as NT Service raises this error: Cannot access database. Please check databasename and net-connectivity OLE DB error occured. Code 800401F0h.
CoInitialize has not been called.

When the same app runs as an Exe I have no problems. Besides DBX-Connection with Borlands MSSQL-DBX-Driver that comes with D7 works.
I´m using D7 and dbexpsda.dll Ver 2.00 (tried also Ver 2.00.3), MSSQL 2000

Have you any advise what can be wrong ?

thanks
Andy

Re: Problems access DB in services

Posted: Thu 18 Nov 2004 12:44
by Ikar
If you would like to use DbxSda in service, console or just at separate thread you need call CoInitialize for each thread. Also remember to call CoUnInitialize at the end of thread.