无法连接到本地SQL Server

时间:2013-08-24 22:03:02

标签: sql-server jdbc

我无法使用jdbc连接到本地SQL Server。此服务器由Windows Authentication进行身份验证。有一点需要提及的是,我使用SQL Server Authentication成功连接到远程SQL Server。

enter image description here

我的代码:

String url = "jdbc:sqlserver://localhost\\SQLEXPRESS;integratedSecurity=true;databaseName=TP3S;";
String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
Connection conn = DriverManager.getConnection(url);

我启用了TCP / IP:

enter image description here

有什么想法吗?谢谢!

- UPDATE -

我刚刚启动了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.

- UPDATE -

我通过在Run-> Run configuration-> Apache Tomcat-> Arguments中添加-Djava.library.path="DLL path"解决了上一个问题。但现在我收到了这个错误:

com.microsoft.sqlserver.jdbc.SQLServerException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

1 个答案:

答案 0 :(得分:1)

在TCP / IP下,您可以通过IP地址启用。检查IP是否已启用。

相关问题