如果用户经过 Active Directory 身份验证,如何将 ODBC 连接字符串发送到 SQL Server?
技术:SQL Server 2008、.NET 2008、Active Directory
我试图通过我的应用程序将连接字符串发送到 SQL Server,以验证存储在 Active Directory 中(而不是本地数据库服务器上)的用户名和密码。
不幸的是,这不起作用,因为当我发送连接字符串时,它只检查 SQL Server 本地用户,而不是根据 Active Directory 检查凭据。有谁知道解决方案吗?
目前使用 ODBC 进行连接。
Technologies:SQL Server 2008, .NET 2008, Active Directory
I'm trying to send a connection string via my application to the SQL Server to authenticate a username and password that is stored in Active Directory, not locally on the db server.
Unfortunately, this isn't working because when I send the connection string, it only checks the SQL server local users, instead of checking the credentials against active directory. Does anyone know of a solution?
Currently using ODBC to make the connection.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法通过这种方式连接到 SQL Server。 SQL Server 仅支持两种连接:
SQL 登录,在何处连接,您为其提供SQL 登录的用户名和密码(即不是 Windows/AD 登录)在该 SQL Server 上定义。或者,
可信连接,在连接位置,您提供NO用户名或密码,它会根据当前 Windows 会话的安全上下文将您连接到会话(假设您已获得如此授权) .
这些是你唯一的选择。如果您希望将 SQL Server 作为不同的 Windows/AD 安全上下文连接,则必须首先使用该上下文创建一个 Windows 会话。
You cannot make a connection to SQL Server in this way. SQL Server supports only two kinds of connections:
SQL Login, where to connect, you supply it with the username and password of a SQL Login (i.e., not a Windows/AD Logon) defined on that SQL Server. or,
A Trusted Connection, where to connect, you supply it with NO username or password and it connects you to a session based on your current Windows session's security context (assuming you are so authorized).
Those are your only choices. If you want to connect to SQL Server as a different Windows/AD security context, you will have to create a Windows session with that context first.