Connecting to SQL Server - Windows authentication - sqljdbc_auth.dll not found

Answered

Hi

I'm trying to connect to SQL Server database using 0xDBE, but I'm receiving following error:

Connection to SQL Server (Microsoft) - <my_db_name>@<db_server_address> failed: Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: File /x86/sqljdbc_auth.dll was not found inside JAR.
    at com.intellij.execution.rmi.RemoteServer.setupDomainAuth(RemoteServer.java:131)
    at com.intellij.execution.rmi.RemoteServer.start(RemoteServer.java:55)
    at com.intellij.database.remote.RemoteJdbcServer.main(RemoteJdbcServer.java:15)
Caused by: java.io.FileNotFoundException: File /x86/sqljdbc_auth.dll was not found inside JAR.
    at com.intellij.execution.rmi.RemoteServer.extractLibraryFromJar(RemoteServer.java:171)
    at com.intellij.execution.rmi.RemoteServer.setupDomainAuth(RemoteServer.java:127)
    ... 2 more



How I got to this point?

  1. I've installed 0xDBE in my user's catalog (d:\Users\<my_username>\Applications\0xDBE\)
  2. I've configured SQL Server (Microsoft) Driver as follows:
      1. Downloaded http://download.jetbrains.com/idea/jdbc-drivers/sqljdbc4-4.0.2206.100.jar manually to d:\Users\<my_username>\Applications\0xDBE\0xDBE 142.2927.6\drivers\ as I had troubles downloading it automatically
      2. Added driver manually on Settings tab.
      3. On advanced tab: I've set integratedSecurity to true
    1. I've added new SQL Server (Microsoft) connection as follows:
      1. Host set to <db_server_address>
      2. Database set to <my_db_name>
      3. Use Windows domain authentication: ticked
      4. URL generated: jdbc:sqlserver://;databaseName=<my_db_name>;servername=<db_server_address>;port=1433
      5. Driver files section indicates that I'm "Using SQL Server (Microsoft) driver files"
      6. On Advanced tab I've changed nothing except I've set integratedSecurity to true
    2. I've clicked "Test Connection"


    Things I've tried:
    Downloading sqljdbc_4.2.6225.100_enu.tar.gz file from http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774 and extracting sqljdbc_auth.dll to d:\Users\<my_username>\Applications\0xDBE\0xDBE 142.2927.6\jre\jre\bin\ - without success.
    Testing connection using Microsoft Excel 2010 external data with connection string:
    Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=<my_db_name>;Data Source=<db_server_address>;Extended Properties="port=1433";Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=<my_workstation_id>;Use Encryption for Data=False;Tag with column collation when possible=False
    and it succeeded. Using same connection string in 0xDBE gave no effects.

    Some info that I believe might be useful:
    Windows 7 64-bit (with NO administrator rights)
    0xDBE (Natasha) DB-142.2927.6
    Build #DB-142.2927, built on July 2, 2015
    JRE: 1.8.0_40-b26 x86
    JVM: Java HotSpot(TM) Server VM by Oracle Corporation
    DB server: Widnows Server 2003 R2 Standard Edition
    DB sql server version: Microsoft SQL Server 2000

    What should I do to make it work? Any hints would be highly appreciated!

    0
    8 comments

    Hello, sorry for delayed reply. Looks like mentioned dll library is not added to classpath or library path. Try using jTds Microsoft driver ans  specify path to the library in VM Options in Advanced tab for the Data Source as -Djava.library.path=<path to MS_SQL_AUTH_DLL> Also try this solution https://youtrack.jetbrains.com/issue/DBE-1406#comment=27-1046286 .

    0
    Avatar
    Permanently deleted user

    @Andrey Dernov
    Your first solution (connecting by jTds driver) worked, thank you! However, if I understand correctly, it is not integratedSecurity that is used for authentication, right? I had to specify my domain, username and password manually and they're now stored "somewhere", right?
    Second solution (youtrack link) didn't help -

    0
    Avatar
    Permanently deleted user

    Connection refused error fro SQL server 2014.  I added the explicit server name and  it shows DatabaseName@localhost.  What do you suggest? 

    0

    If you are connecting via TCP port, make sure that the SQL Server is configured to accept remote connections on the specified ip address and listens for tcp connections on the specified port number.

    If you are connecting via named instance, please make sure to specify instance name in the connection settings and omit specifying the port. 

    You can also try DataGrip 2016.1 which has some improvements in connection issues diagnostics for MS SQL Server: http://blog.jetbrains.com/datagrip/2016/03/11/datagrip-2016-1-is-open/ .

     

    0
    Avatar
    Permanently deleted user

    https://msdn.microsoft.com/en-us/library/ms177440.aspx

    How to enable port 1433 fixed the connection issue.

    Thanks

    0
    Avatar
    Permanently deleted user

    I figured out how to make the driver to work. All you need is to create zip file and insert there content of sqljdbc42.jar ()jar is just a zip and you can open it with any zip extractor) (from sqljdbc_6.0) + content of sqljdbc_6.0\enu\auth\ so you'll have the following folders in the zip file:

    1. com
    2. META-INF
    3. microsoft
    4. x64
    5. x86
    And after that add the file to drivers. Use SQL Server Microsoft driver in Data Source and Drivers window..

    0
    Avatar
    Permanently deleted user

    @Nick, thank you! That saved me a lot of time :)

    0

    @Nick

    Thanks, it works! Of all the methods described here, only this method has helped for me. But I added directories directly to the jar file, detaching it in the my archiver.

    0

    Please sign in to leave a comment.