I'm unable to connect to a local SQL Server with jdbc. This server is authenticated by Windows Authentication
. One thing to mention is that I successfully connected to a remote SQL Server with SQL Server Authentication
.
My code:
String url = "jdbc:sqlserver://localhost\\SQLEXPRESS;integratedSecurity=true;databaseName=TP3S;";
String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
Connection conn = DriverManager.getConnection(url);
I have enabled TCP/IP:
Any ideas? Thanks!
--UPDATE--
I have just started SQL Server Browser, now I'm getting the error:
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--
I solved the previous problem by adding -Djava.library.path="DLL path"
in Run->Run configuration->Apache Tomcat->Arguments. But now I'm getting this error:
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.