dll missing in JDBC
Asked Answered
J

10

22

I am currently working with SQL in Java. Recently I got this error:

com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit>
WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path

This happens when I add the parameter integratedSecurity=true; in the connection String. The error message clearly says that sqljdbc_auth.dll is missing, so I tried to put the dll in the same path as I keep sqljdbc4.jar.

However, this doesn't work, so I wanted to know how I actually can add this dll to my build path? Is there a special way to do it?

Jennette answered 24/6, 2013 at 13:42 Comment(1)
afaik you need add path to dll into Windows property PATHPropagation
J
10

Alright guys, I found it out! I didn't really need to change the java.library.path but the "Native library location" of sqljdbc.jar

This is the best answer I could find: https://mcmap.net/q/125436/-how-to-set-the-java-library-path-from-eclipse

It works now, thanks for the support!

Jennette answered 25/6, 2013 at 7:56 Comment(0)
C
45

keep sqljdbc_auth.dll in your windows/system32 folder and it will work.Download sqljdbc driver from this link Unzip it and you will find sqljdbc_auth.dll.Now keep the sqljdbc_auth.dll inside system32 folder and run your program

Cybele answered 1/10, 2013 at 12:25 Comment(0)
B
12

For easy fix follow these steps:

  1. goto: https://learn.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
  5. paste in: C:\Program Files\Java\jdk_version\bin

restart either eclipse or netbeans

Biles answered 27/9, 2017 at 0:5 Comment(2)
Alternatively, copying only to C:\Windows\System32 folder also works.Birdlime
Note that sqljdbc_auth.dll has been rename to mssql-jdbc_auth-x.x.x.x86.dll starting from version 8 of the JDBC driver. So you need to copy and then rename the dll.Crackpot
J
10

Alright guys, I found it out! I didn't really need to change the java.library.path but the "Native library location" of sqljdbc.jar

This is the best answer I could find: https://mcmap.net/q/125436/-how-to-set-the-java-library-path-from-eclipse

It works now, thanks for the support!

Jennette answered 25/6, 2013 at 7:56 Comment(0)
D
4

You need to set a -D system property called java.library.path that points at the directory containing the sqljdbc_auth.dll.

Discriminative answered 24/6, 2013 at 13:47 Comment(1)
Could you please be more specific? I don't know how to do thisJennette
T
4

Set java.library.path to a directory containing this DLL which Java uses to find native libraries. Specify -D switch on the command line

java -Djava.library.path=C:\Java\native\libs YourProgram

C:\Java\native\libs should contain sqljdbc_auth.dll

Look at this SO post if you are using Eclipse or at this blog if you want to set programatically.

Trichloroethylene answered 24/6, 2013 at 13:55 Comment(1)
Thank you! The description on the top wasn't very clear, I consider you to edit it a little bit. In return, your link to #958200 helped me a lot! This is where I found the answer to my problemJennette
O
2

If its the case of the dll file missing you can download the dll file from this link http://en.osdn.jp/projects/sfnet_dose-grok/downloads/sqljdbc_auth.dll/

else you need to provide the username and password of the db you are trying to connect, and make the authentication as false

Obediah answered 28/10, 2015 at 12:25 Comment(0)
F
2

In my case after spending many days on this issues a gentleman help on this issue below is the solution and it worked for me. Issue: While trying to connect SqlServer DB with Service account authentication using spring boot it throws below exception.

com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId:ab942951-31f6-44bf-90aa-7ac4cec2e206 at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2392) ~[mssql-jdbc-6.1.0.jre8.jar!/:na] Caused by: java.lang.UnsatisfiedLinkError: sqljdbc_auth (Not found in java.library.path) at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1462) ~[na:2.9 (04-02-2020)] Solution: Use JTDS driver with the following steps

  1. Use JTDS driver insteadof sqlserver driver.

    ----------------- Dedicated Pick Update properties PROD using JTDS ----------------

    datasource.dedicatedpicup.url=jdbc:jtds:sqlserver://YourSqlServer:PortNo/DatabaseName;instance=InstanceName;domain=DomainName
    datasource.dedicatedpicup.jdbcUrl=${datasource.dedicatedpicup.url}
    datasource.dedicatedpicup.username=$da-XYZ
    datasource.dedicatedpicup.password=ENC(XYZ)
    datasource.dedicatedpicup.driver-class-name=net.sourceforge.jtds.jdbc.Driver
    
  1. Remove Hikari in configuration properties.

    #datasource.dedicatedpicup.hikari.connection-timeout=60000 #datasource.dedicatedpicup.hikari.maximum-pool-size=5

  2. Add sqljdbc4 dependency.

    com.microsoft.sqlserver sqljdbc4 4.0
  3. Add Tomcatjdbc dependency.

    org.apache.tomcat tomcat-jdbc
  4. Exclude HikariCP from spring-boot-starter-jdbc dependency.

    org.springframework.boot spring-boot-starter-jdbc com.zaxxer HikariCP
Fleischman answered 24/2, 2021 at 20:49 Comment(0)
T
0

You have to make sure your DLL is in the classpath.

One such way to do so is to put the path to the DLL in PATH environment variable.

Other option is to add it to the VM arguments in the variable LD_LIBRARY_PATH, like this:

java -Djava.library.path=/path/to/my/dll -cp /my/classpath/goes/here MainClass

Tamp answered 24/6, 2013 at 13:47 Comment(0)
B
0

Friends I had the same problem because of the different bit version Make sure following point * Your jdk bit 64 or 32 * Your Path for sqljdbc_4.0\enu\auth\x64 or x86 this directory depend on your jdk bit * sqljdbc_auth.dll select this file based on your bit x64 or x86 and put this in system32 folder and it will works for me

Berry answered 19/1, 2016 at 5:22 Comment(0)
D
0

The sqljdbc_auth.dll is within the sqljdbc_x.x folder you install to retrieve the sqljdbcxx.jar file in the auth folder. Create a lib folder at the base of your scala project and move sqljdbc_auth.dll into this folder. This makes sure that you are getting the correct file, e.g. 64 bit or 32 bit that matches your sqljdbcxx.jar file.

Dupe answered 21/7, 2017 at 12:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.