pythonian29033
pythonian29033

Reputation: 5207

MS SQL Server '08 ignoring username and password when requesting a connection with connection string using Integrated security=SSPI

I'm using this connection string to connect to a ms sql server '08 db,

"Data Source=qwe;Initial Catalog=dsa;Integrated Security=SSPI;User Id=mydom\unamee;Password=pwd;"

but the server is ignoring the username i specify and uses my machine name instead; and says that it is unable to authenticate user mydom\myMachineName I've check the other similar question, but that is not the same as this problem, someone please help, my head is breaking

Upvotes: 0

Views: 813

Answers (2)

Dario Ayala
Dario Ayala

Reputation: 1

In order to use a domain account to connect to Sql Server you have to be logged with that account, Integrated Security=SSPI; pass to SQL the current domain credentials,User Id and Password values in connection string are used to send SQL Server user (not domain user) and password to connect to it, but in this case your Sql Server has to be set in mixed mode security to allow this kind of credentials. Sorry about my english, I hope this was useful for you. Regards

Upvotes: -1

Nenad Zivkovic
Nenad Zivkovic

Reputation: 18559

When you use Integrated Security=SSPI (or true), UserID and password you have specified are ignored. Login will be made using the windows credentials you are logged in Windows\domain. In that case you'll need to have an appropriate windows login created in SQL Server.

If you want to use SQL Server login, specifying username and password created in SQL Server -you should set 'Integrated Security=false or remove that property altogether because false is default value.

EDIT:

To make a long story short: You can either use Integrated security or username/password and not both. You can not log in using someone else's domain account, only of user logged in Windows at the moment.

Upvotes: 2

Related Questions