简体   繁体   English

如果用户通过 Active Directory 身份验证,如何将 ODBC 连接字符串发送到 SQL 服务器?

[英]How can I send an ODBC connection string to an SQL server if the user is authenticated by Active Directory?

Technologies:SQL Server 2008, .NET 2008, Active Directory技术:SQL 服务器 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.我正在尝试通过我的应用程序将连接字符串发送到 SQL 服务器,以验证存储在 Active Directory 中的用户名和密码,而不是本地存储在数据库服务器上。

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.不幸的是,这不起作用,因为当我发送连接字符串时,它只检查 SQL 服务器本地用户,而不是检查活动目录的凭据。 Does anyone know of a solution?有谁知道解决方案?

Currently using ODBC to make the connection.目前使用 ODBC 进行连接。

You cannot make a connection to SQL Server in this way.您无法以这种方式连接到 SQL 服务器。 SQL Server supports only two kinds of connections: SQL 服务器只支持两种连接方式:

  1. SQL Login, where to connect, you supply it with the username and password of a SQL Login (ie, not a Windows/AD Logon) defined on that SQL Server. SQL 登录,在哪里连接,您提供SQL 登录(即,不是Windows/AD 登录)的用户名和密码在该 Z9778840A0100CB30C982876741B0B 上定义。 or,或者,

  2. 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).一个受信任的连接,在哪里连接,您不提供用户名或密码,它会根据您当前的Windows会话的安全上下文将您连接到 session(假设您已获得如此授权)。

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.如果要连接到 SQL 服务器作为不同的 Windows/AD 安全上下文,则必须首先使用该上下文创建Windows session。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在SQL Server 2016中添加Active Directory用户或组作为登录? - How to add Active Directory user or group as login in SQL Server 2016? 如何在SQL Server连接字符串中隐藏用户ID /密码? - How can I hide userid/password in a SQL Server connection string? 如何更改几个Active Directory用户密码? - How can I change several Active Directory user passwords? 如何在.NET Web应用程序中为经过身份验证的用户获取UPN,而无需查询Active Directory - How to get UPN for authenticated user in .NET web application, without querying Active Directory 如何在类中定义 SQL Server 连接字符串并在项目中随处使用? - How can I define SQL server connection string inside a class and use everywhere in project? 我在哪里/如何存储SQL Server连接字符串,以便它可以安全地用于远程应用程序? - Where/how can I store SQL Server connection string so that its securely available to remote apps? 如何使用到活动目录的特定网络连接来检索用户信息 - How to use specific network connection to active directory to retrieve user info 通过 ODBC 连接连接到 Sql Server CE - Connecting to Sql Server CE via ODBC Connection 如何使用 PrincipalSearcher 按公用名在 Active Directory 中查找单个用户? - How can I find a single user in Active Directory by common name using PrincipalSearcher? 如何在C#中的任何网络服务器上为自适应服务器设置ODBC连接字符串 - How to set ODBC connection string for adaptive server anywhere network server in C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM