用户未与受信任的SQL Server连接关联

时间:2022-02-07 04:46:56

i wrote the code like this to connect sqlserver database.i load the driverclass,but iam not getting connection.

我写这样的代码连接sqlserver database.i加载驱动程序类,但我没有得到连接。

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");      
System.out.println("class Loaded");         
connection = 
    DriverManager.getConnection(
        "jdbc:sqlserver://10.171.160.114:2001",
        "XXXXXX",
        "XXXXXX");      
System.out.println("connected");

iam getting this error " The user is not associated with a trusted SQL Server connection. ".please advice me on this.any help greately appreciated.

我收到此错误“用户未与受信任的SQL Server连接相关联。”。请为此提供建议。非常感谢您的帮助。

2 个解决方案

#1


The SQL server has been configured to operate in "Windows Authentication Mode (Windows Authentication)" and doesn't allow the use of SQL accounts. Right click on your SQL Server node in Management Studio and choose Properties. On the dialog that appears go to security tab and make sure that "SQL Server and Windows Authentication mode" is selected

SQL Server已配置为在“Windows身份验证模式(Windows身份验证)”中运行,并且不允许使用SQL帐户。右键单击Management Studio中的SQL Server节点,然后选择“属性”。在出现的对话框中转到安全选项卡,并确保选中“SQL Server和Windows身份验证模式”

#2


It probably has to do with the authentication mechanism you use. See this question for details.

它可能与您使用的身份验证机制有关。有关详细信息,请参阅此问

For more information, read here.

有关更多信息,请阅读此处。

#1


The SQL server has been configured to operate in "Windows Authentication Mode (Windows Authentication)" and doesn't allow the use of SQL accounts. Right click on your SQL Server node in Management Studio and choose Properties. On the dialog that appears go to security tab and make sure that "SQL Server and Windows Authentication mode" is selected

SQL Server已配置为在“Windows身份验证模式(Windows身份验证)”中运行,并且不允许使用SQL帐户。右键单击Management Studio中的SQL Server节点,然后选择“属性”。在出现的对话框中转到安全选项卡,并确保选中“SQL Server和Windows身份验证模式”

#2


It probably has to do with the authentication mechanism you use. See this question for details.

它可能与您使用的身份验证机制有关。有关详细信息,请参阅此问

For more information, read here.

有关更多信息,请阅读此处。