[英]Login failed for user '' while connecting to SQL Server 2005 through windows authentication from Java
尝试连接到SQL Server时出现此错误。
错误是:
Login failed for user ''. The user is not associated with a trusted SQL Server connection.
服务器位于远程。 从我的本地主机,我尝试使用以下URL连接:
"jdbc:sqlserver://serverName:portNo;integratedSecurity=true;databaseName=myDB"
但是,当我使用msSQL studio工具连接到执行Windows身份验证的sql服务器时,它可以毫无错误地连接我。
两种情况有什么区别?
任何帮助表示赞赏。
谢谢
如果连接字符串中有多余的空格,则会发生这种情况。 看起来您已经修改了上面的示例以隐藏服务器名称-确保您的实际连接字符串不包含任何空格。 参见http://blogs.msdn.com/b/sql_protocols/archive/2005/09/28/474698.aspx
如果您的Web应用程序在不同的用户下运行,也可能发生这种情况,即与您用于运行SQL Server Management Studio的用户不同。 参见http://blogs.msdn.com/b/sql_protocols/archive/2008/05/03/understanding-the-error-message-login-failed-for-user-the-user-is-not-associated-with -a-trusted-sql-server-connection.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.