Am trying to connect MS SQL server through java web applications.
Class.forName(\"com.microsoft.sqlserver.jdbc.SQLServerDriver\");
connection= DriverManager
sqljdbc_auth.dll
is need to use windows authentication or Kerberos authentication.
Get the dll from Microsoft and install it either by:
drop on the java bin folder.
Not recommended if you want to package the applications with all the dependencies. Also, it requires to find what java version is being used and from what path.
drop the library on some folder and then add the path in the command line:
java -Djava.library.path=<library path>...
The mssql-jdbc
driver and the sqljdbc_auth.dll
should be:
Check also the jdbc comparability matrix with java versions.
The JDBC driver supports the use of Type 2 integrated authentication on Windows operating systems through the integratedSecurity connection string property. To use integrated authentication, copy the sqljdbc_auth.dll
file to a directory on the Windows system path on the computer where the JDBC driver is installed.
Alternatively you can set the java.libary.path
system property to specify the directory of the sqljdbc_auth.dll
. For example, if the JDBC driver is installed in the default directory, you can specify the location of the DLL by using the following virtual machine (VM) argument when the Java application is started:
-Djava.library.path=c:/sqljdbc_<version>/enu/auth/x86
or
-Djava.library.path=c:/sqljdbc_<version>/enu/auth/x64
Please read more about in the original documentation: https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-2017