2

How to create a SQL connection string to connect a SQL Server instance using another Windows account? I need to provide the Windows user name (not SQL Server login) and password and force the server to use this credentials while creating a connection.

Integrated Security=SSPI picks my PC user account and password

Is there a way to accomplish this?

Please advise.

Thanks, KihtraK

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Kihtrak J
  • 132
  • 1
  • 2
  • 7
  • would this help? http://msdn.microsoft.com/en-us/library/ff647396.aspx#paght000008_step3 – Matt Nov 24 '14 at 14:38
  • 1
    Why do you want to do that instead of adding a Windows login to SQL Server? Windows authentication is used so you can add uses without disclosing their passwords, or storing them in config files. What problem are you trying to solve? There are probably other ways to do it that don't require bypassing security – Panagiotis Kanavos Nov 24 '14 at 14:50

1 Answers1

4

Yes, and quite trivial.

Finished. Internal security will now work with the impersonated user. Impersonation is explicitly done to NOT have to deal with username and password.

Community
  • 1
  • 1
TomTom
  • 61,059
  • 10
  • 88
  • 148
  • That defeats the whole purpose of using Windows accounts instead of SQL Server logins and should be avoided. Using SQL logins would be safer in this case. – Panagiotis Kanavos Nov 24 '14 at 14:52
  • Actually no. It is for example used in IIS. This way you can pass through a windows authentication over to the server. Like IIS can do asking the user for username and password. Or using a specific hardcoded identitity to connect to sql server, not the website one. – TomTom Nov 24 '14 at 14:54
  • I think the technical aspects of the discussion here are important, but I suspect there might be some semantic difference between what is being expressed. Could we restart from here? – Andrew Barber Nov 24 '14 at 16:05