June 22, 2015 at 6:31 am
I'm trying to connect to a database using a service account that we got created. The ID is an AD account and was added to the db as such. When I try to connect to the database using the account with the password I get [login failed for domain\id]. The DBA mentioned that its setup to use windows auth, however, I can't connect with this service account using windows Auth, due to I'm using to connect via code.
How can I connect to the database from my code using this ID?
I have the ID and pwd in my code to connect with, does the ID have to be setup differently in the Database?
June 22, 2015 at 7:10 am
Is your connection string something like this:
Persist Security Info=False;User ID=DOMAIN\USER;Password=PASSWORD;Initial Catalog=AdventureWorks;Server=MySqlServer
That is not going to work. This is what you would use for SQL authentication.
To use Windows authentication, this needs to be added to the connect string:
Integrated Security=SSPI
But you cannot specify the user and password. It uses the security of the login that started the application.
Plus, using a service account to run an app is probably not a good idea. Create a SQL login, grant it the minimum level of rights, and use that to connect.
Michael L John
If you assassinate a DBA, would you pull a trigger?
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply