代表用户连接到SQL但仍保留用户 [英] Connecting to SQL on behalf of a user but still retain user

查看:83
本文介绍了代表用户连接到SQL但仍保留用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个WCF服务,它代表用户建立了与我的数据库的所有连接(使用NT进程帐户)。我的DBA质疑如果出现问题,我们将如何知道哪个用户实际运行查询,我们需要终止该请求。



无论如何编码都是为了让我可以向原始用户显示我代表的行为,但仍然在进程帐户下运行sql?我知道我在这里伸展......任何想法都会得到真正的赞赏!



更新:

我想指出......我仍然需要在进程帐户下运行SQL ...而不是调用用户。 SQL是否有办法让我知道我正在为用户运行SQL但不是AS用户,但仍然让SQL知道用户ID正在代表。有意义吗?

I am running a WCF service that makes all connections to my databases on behalf of the user (using an NT process account). My DBA''s questioned how would then know which user is actually running a query should there be issues and we need to kill that request.

Is there anyway of coding so that I can show the original user who I am acting on behalf of but still run the sql under the process account? I know I am stretching here...any ideas would be truely appreciated!

UPDATE:
I want to point out...I still need to run the SQL under the process account...not the calling user. Does SQL have a way I can let it know I am runing the SQL FOR a user but not AS a user but still let SQL know the user id am working on behalf of. Make sense?

推荐答案

我不确定这是否适合您的工作,但我的WCF将接收用户凭据作为函数的参数的一部分我正在运行,然后在数据访问层中构建一个连接字符串。然后我可以使用该连接字符串打开SQL连接。
I''m not sure if this fits what you are doing, but my WCF will receive user credentials as part of the parameters to the function I am running and then construct a connection string within the data access layer. Then I can use that connection string to open the SQL Connection.


这篇关于代表用户连接到SQL但仍保留用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆