通过 ODBC 连接到 SQL Server 失败
我有一个奇怪的问题。我可以以管理员身份从一台终端服务器连接到 SQL 服务器。我还可以作为普通用户通过直接 SQL 连接连接到服务器。当我尝试使用 odbc 登录到服务器时,我收到以下错误。
07/08/2011 10:49:14,登录,未知,用户“”登录失败。原因:尝试使用 SQL 身份验证登录失败。服务器配置为仅用于 Windows 身份验证。 [客户端:10.0.0.25] 07/08/2011 10:49:14,登录,未知,错误:18456 严重性:14 状态:58。
SQL 服务器肯定处于混合模式,并且在连接中肯定设置了用户。应该是权限问题。
I have a strange issue. I can connect from one Terminal server to the SQL server as an admin. I can also connect to the server via a straight SQL connection as a normal user. When I try and log on to the server using odbc I receive the following error.
07/08/2011 10:49:14,Logon,Unknown,Login failed for user ''. Reason: An attempt to login using SQL authentication failed. Server is configured for Windows authentication only. [CLIENT: 10.0.0.25]
07/08/2011 10:49:14,Logon,Unknown,Error: 18456 Severity: 14 State: 58.
The SQL server is definitely in mixed mode and a user is definitely set up in the connection. It must be a permissions issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试登录的用户可能没有他/她尝试连接的数据库的权限。
转到 SQL Server >安全>选择用户 - 右键单击>属性>用户映射
然后选择用户需要访问的数据库(地图列中的复选框)
我很确定之前发生过错误,这就是我修复它的方法。假设您的服务器确实已设置为混合模式。
Probably the user that tries to login does not have permission to the database he/she is trying to connect.
Go to the SQL Server > Security > Select the User - Right Click > Properties > User Mapping
And there select the database that user needs to access (check box in the map column)
I'm pretty sure that error had happened to me before that that's how I fixed it. Assuming it is true that your server is setup as mixed mode already.
如果您使用 ado.net,请确保使用 ODBC 数据适配器、连接器和 odbcCommands 而不是 SQL 的。 ;)
If your using ado.net, make sure your using the ODBC data adapter, connectors and odbcCommands instead of the SQL ones. ;)