Friday, January 26, 2018

Error in creating Microsoft SQL server connection

Error:
Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library

This is the basic error and this will have a full stack trace.
When creating database connection, you must have enabled the "integratedSecurity=true".
This will enable LDAP users to access the database.

Solution :



1.goto: https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url#Connectingintegrated
2. Download the JDBC file and extract to your preferred location
3.open the auth folder matching your OS x64 or x86
4. copy sqljdbc_auth.dll file and paste in: C:\Program Files\Java\jdk_version\bin
restart either eclipse or netbeans

In a case when you do not have permission to copy the files to folders.
set thi as a VM argument
In eclipse

1) Create a folder 'sqlauth' in your C: drive, and copy the dll file sqljdbc_auth.dll to the folder
2) Go to Run> Run Configurations
3) Choose the 'Arguments' tab for your class
4) Add the below code in VM arguments:
         -Djava.library.path="C:\\sqlauth"
5) Hit 'Apply' and click 'Run'

https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url#Connectingintegrated
https://blogs.msdn.microsoft.com/jdbcteam/2017/03/31/jdbc-download-center-pages-and-repackaging/



No comments:

Post a Comment