![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have one machine with an application running that many users need to log in and out of quickly. Logging off the machine, logging in and restarting the app takes too long. Users already log into the application using their windows login and password which I check against the AD, then I build connections strings so SQL Server knows who is logged in - which I need for auditing. Using SQL authentication is not an option. Is it possible to make a connection string to SQL Server using Windows Authentication using a different windows user than the one logged into the machine? |
#3
| |||
| |||
|
|
Matthew Wells (matthew.wells (AT) firstbyte (DOT) net) writes: I have one machine with an application running that many users need to log in and out of quickly. Logging off the machine, logging in and restarting the app takes too long. Users already log into the application using their windows login and password which I check against the AD, then I build connections strings so SQL Server knows who is logged in - which I need for auditing. Using SQL authentication is not an option. Is it possible to make a connection string to SQL Server using Windows Authentication using a different windows user than the one logged into the machine? No. You could use the RunAs functionality in Windows to impersonate the user. The other alternative is to have the Windows session being logged in by a service user. This server would then do an EXECUTE AS LOGIN when connected to SQL Server. Or use SET CONTEXT_INFO and then the context_info() function, but that may require you to do changes to the SQL code. -- Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx |
#4
| |||
| |||
|
|
I appreciate the response, but I don't think this helps. A regular user is definitely logged in so a service user is out. I did a trick a few years back where I added "WSID= " + CurrentUser to the connection string and then used @@Host_ID to get the user. Seems really lame. I was really hoping there was a more logical way. |
#5
| |||
| |||
|
|
Matthew Wells (matthew.wells (AT) firstbyte (DOT) net) writes: I appreciate the response, but I don't think this helps. A regular user is definitely logged in so a service user is out. I did a trick a few years back where I added "WSID= " + CurrentUser to the connection string and then used @@Host_ID to get the user. Seems really lame. I was really hoping there was a more logical way. I'm sorry if my response was not helpful enough, but since I only get a glimpse of your environment, it's difficult to say which ideas that would be workable. The one thing I can say with certainty is that if you are logged into Windows as user X, you cannot log into SQL Server with Windows authentication as user Y. This is a fundamental thing. Windows authentication works from the principle that Windows have already authenticated you, and that's why SQL Server lets you in. -- Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx |
![]() |
| Thread Tools | |
| Display Modes | |
| |