Link to home
Create AccountLog in
Avatar of jwagman
jwagmanFlag for United States of America

asked on

How to use SSPI in my connection string?

I'd like to use SSPI rather than sending a password, etc. across the wire. Can someone give me a quick rundown how I have to setup users in Server2005 to use SSPI and then use SSPI from
Avatar of chapmandew
Flag of United States of America image

Avatar of jwagman


I really need a better understanding of SSPI vs. sending a username/pwd from my app. doesn't seem to address that.
as shown on the page:

Trusted Connection (SSPI):
Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;

Standard security:
Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Avatar of jwagman


But how are the users set up in Sql Server to use SSPI?
>But how are the users set up in Sql Server to use SSPI?
you have to create logins on SQL Server security just as sql logins, with the following 2 differences:
* the login will be based on the existing windows account
* the login could be a windows group account, making all windows members of that windows group getting all permissions you grant to the sql window account.
Avatar of jwagman


Login based on existing Windows a/c: could you advise how I coulld get this data from a application?
What do you mean get it from a application?  When you login to the db using sspi, it is using the windows account that you are logged in as.  Does this make sense?
Avatar of jwagman


But do I have to set up username/password in db first? How do I get that w/o asking user for his/her windows password, for example?
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
No, nothing to set.  If you put SSPI in your conn string, the application will authenticate you automatically.
angelll, take a look at this question when you get a chance....I think you have a function that parses out strings that can help this user..