Board index » delphi » Authentication problem Service using ADO

Authentication problem Service using ADO


2004-04-23 06:11:25 AM
delphi159
Hi,
I've written a service is Delphi 5 to query a remote sql server database.
When the query kicks off, I get this error: Login failed for user 'NT
AUTHORITY\ANONYMOUS LOGON'
When I do this same thing from a normal application it works fine.
I gather this works because I am currently logged on to my workstation so its
using my currently logged in user/pass, but with a service I dont
necessarily need to be logged in.
So how do I specify a username and password in my code so the database
doesn't think I am anonymous?
Thanks,
Dan Tiedeman
 
 

Re:Authentication problem Service using ADO

Quote

I've written a service is Delphi 5 to query a remote sql server database.

When the query kicks off, I get this error: Login failed for user 'NT
AUTHORITY\ANONYMOUS LOGON'

When I do this same thing from a normal application it works fine.
I gather this works because I am currently logged on to my workstation so
its
using my currently logged in user/pass, but with a service I dont
necessarily need to be logged in.

So how do I specify a username and password in my code so the database
doesn't think I am anonymous?

Thanks,

Dan Tiedeman


OK, I figured this out...
I commented out 'Integrated Security=SSPI' and added password and username
to my connection string.
s_connectStr := 'Provider=SQLOLEDB.1;'
+ 'Password='
+ s_password
//+ ';Integrated Security=SSPI'
+ ';Trusted_Connection=true'
+ ';Persist Security Info=True;'
+ 'User ID='
+ s_UserID
+ ';Initial Catalog='
+ s_DBName
+ ';Data Source='
+ s_DBServer
+ ';';
It works now.
Thanks,
Dan Tiedeman