我无法使用 jdbc 连接到本地 SQL Server。此服务器由 验证 Windows Authentication
。值得一提的是,我使用SQL Server Authentication
.
我的代码:
String url = "jdbc:sqlserver://localhost\\SQLEXPRESS;integratedSecurity=true;databaseName=TP3S;";
String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
Connection conn = DriverManager.getConnection(url);
我已启用 TCP/IP:
有任何想法吗?谢谢!
- 更新 -
我刚刚启动了 SQL Server Browser,现在我得到了错误:
WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication.
- 更新 -
-Djava.library.path="DLL path"
我通过添加Run->Run configuration->Apache Tomcat->Arguments解决了前面的问题。但现在我收到了这个错误:
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.