Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Which is the best way to create a connection string for SQL Server?

Should I be using a trusted connection string (windows authentication) or an untrusted connection string (sql server authentication) and why?

share|improve this question
-1 since you should attempt to show more information about your specific situation, and what concerns you have about either solution. – Max Vernon Sep 24 '12 at 16:46
my concern is to make connection string more secure, so that it does not get compromise by any attack. i have read on many forums that windows authentication is more secured and if we use sql authentication then user id and password then they can be availabe on network(how?). – ravi Sep 25 '12 at 9:30
up vote 6 down vote accepted

Windows Authentication is going to be the most secure means, as opposed to SQL Server Authentication. The reason behind this is because with Windows Authentication, the OS handles the auth as opposed to SQL Server handling it with its respective method.

When you use Windows Auth, SQL Server just uses the authentication token that is stored when you log into Windows (the OS). This token-based security is more secure than SQL Server's native username/password security.

In other words if you can, choose Windows Authentication. There are times though when you cannot get around SQL Server authentication (legacy application, third-party vendor, etc.).

share|improve this answer
can you please explain, what is this token based security in windows based authentication? – ravi Sep 22 '12 at 6:24

In my opinion, when it comes how secure the connection is, Windows authentication might works better, however you will be constraint and dependent on that along the way. For example if for some reasons there was a problem in windows users, the issue will flow to SQL accessibility as well. Usually the network and infrastructure person is different from SQL development team, so the DBA would be dependent on them tightly for applying changed on who can login or not.

share|improve this answer
While that is a viable consideration for maintenance/troubleshooting, the inconvenience isn't justification to minimize security. – Thomas Stringer Sep 4 '12 at 3:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.