1

tI'm using Sql Server with Windows Authentication enabled. Recently I added a dropdown to allow for different connections. One of them uses SQL Authentication.

I consulted msdn and it seems all I need to do is add a Username and Password entry to my string.

http://msdn.microsoft.com/en-us/library/aa905872(v=sql.80).aspx

My windows authentication string :

Data Source=PC\Slike;Initial Catalog=db_slike_articles;Integrated Security=True

The second string I added for SQL Authentication :

Data Source=Data Source=PC\Dev;Initial Catalog=db_dev_articles;Integrated Security=True;User ID=root;Password=rootpwd

For some reason when I choose the 2nd SQL connection it's throwing an SqlException that login failed with my PC\Slike username. The connection string is the second one with the User ID and Pwd, I don't understand why it's trying to connect against my local account.

The second string is located on a remote machine, is there something I have to enable to switch from Windows Auth to Sql Auth or does specifying the the credentials within the string is enough?

Thanks

1
  • The SQL Authentication connection string still has Integrated Security=True in there, so Windows Auth is probably still going to be used. You should perhaps remove it to see if that changes things Commented Apr 16, 2013 at 22:53

1 Answer 1

1

when using SQL Authentication, remove this from the connection string:

Integrated Security=True;

there is a web site listing all possible/supported syntax of connection strings for all database engines, I can't find it now, connectionstrings.com does not load properly.

Sign up to request clarification or add additional context in comments.

1 Comment

You are totally right, I just saw Use the Integrated Security keyword, set to a value of SSPI, to specify Windows Authentication (recommended) in the page I linked. I think it's time to call it a day. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.