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 vb.net?
Thanks.
Avatar of chapmandew
chapmandew
Flag of United States of America image

Avatar of jwagman

ASKER

I really need a better understanding of SSPI vs. sending a username/pwd from my app. www.connectionstrings.com doesn't seem to address that.
as shown on the page:
http://www.connectionstrings.com/?carrier=sqlserver2005


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

ASKER

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

ASKER

Login based on existing Windows a/c: could you advise how I coulld get this data from a vb.net application?
What do you mean get it from a vb.net 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

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
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..

https://www.experts-exchange.com/questions/23229823/SQL-Server-Function.html?cid=295