com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication.


On a Windows platform, when trying to connect to SQL Server using Integrated Authentication, you may see this exception:
    com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication.
along with the following trace message:
    com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit>
    WARNING: Failed to load the sqljdbc_auth.dll


This generally indicates that the driver can not find the appropriate sqljdbc_auth.dll in the JVM library path.  To correct the problem, please use the java.exe -D option to specify the “java.library.path” system property value.  You will want to specify the full path to the directory contain the sqljdbc_auth.dll.
    For example:  java -cp .;”c:\jdbcv1_2\sqljdbc.jar” -Djava.library.path=”c:\jdbcv1_2\auth\x86″ myApp


Alternatively, you can copy the sqljdbc_auth.dll to a directory in the search path (example: the local directory where you are executing your application).


Note: You may also get the same error message if the application is trying to use the incorrect architecture (x86 VS x64) version of the sqljdbc_auth.dll.  Try specifying the directory path to the other architecture.
If you are on a x64 machine running x64 OS, but the JVM you are using is the x86 version, you will need to specify and use the x86 version of the sqljdbc_auth.dll.


Some related information:
If you get the following exception:
  java.lang.UnsatisfiedLinkError: GetDNSName
This typically indicates that the application is trying to use the incorrect version (say v1.0 VS v1.1) of the sqljdbc_auth.dll.  Make sure the application is using the save version of the sqljdbc.jar and sqljdbc_auth.dll files.


Jimmy Wu, SQL Server
Disclaimer: This posting is provided “AS IS” with no warranties, and confers no rights

Comments (40)

  1. Adrien says:

    A question about this, if we have one server for SQL Server 2005 and another one for the WebServer, where must we specify the "java.library.path" system property value?

    On the webserver or on the SQL Server?

    Thank you!

    Adrien

  2. dpblogs says:

    You would want to configure the "java.library.path" system property value on the same machine where you installed the sqljdbc.jar file, since it is the JAVA application that is running the JDBC driver that needs the DLL.  I would imagine in your scenario, it would be the WebServer.

    HTH,

    Jimmy Wu

  3. Yash Giri says:

    I am trying to get Websphere 6.1 app server to connect to MSSQL Server 2005(via Hibernate) using Windows integrated Security/Authentication.

    >> My jdbc.proerties lokked like this …

    jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver

    jdbc.url=jdbc:sqlserver://172.16.1.3;instanceName=ads;database=qa_vyasa_ads;integratedSecurity=true;

    >> I have placed the "sqljdbc.jar" in the application lib folder.

    >> My application would start but, would throw the following exception …

    ——————————————————————————————————-

    [2/13/08 15:52:51:359 IST] 00000016 SystemOut     O 2008-02-13 15:52:51,312 WARN [org.hibernate.cfg.SettingsFactory] – <Could not obtain connection metadata>

    org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (This driver is not configured for integrated authentication.)

    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855)

    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)

    at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)

    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)

    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2006)

    .

    .

    .

    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication.

    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(Unknown Source)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(Unknown Source)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)

    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)

    at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)

    at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)

    at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)

    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)

    … 44 more

    ——————————————————————————————————-

    >> I had not added the path of the "sqljdbc_auth.dll" file into the java.library.path JVM start params.

    – SO I added the path into the systems "PATH" environment variable and now its part of the the "java.library.path"

    >> The above exception is gone.But websphere would not start, it starts and shuts down automatically.

    Please let me know if I am missing something in the Websphere 6.1 environment.

    ****** I followed the same steps with Tomcat 5.0 and integratedSecurity works like charm.The issue is only with Websphere 6.1 ******

    Many thanks for your time.

    –Yash

  4. dpblogs says:

    Hi Yash,

    I noticed that you’ve posted on the "SQL Server Data Access" forum as well (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1393578&SiteID=1).  I’ll use the forum posting to try and help you solve your configuration issue.

    Jimmy

  5. Ray says:

    Hi Jimmy,

    Thanks for the post.  However,  I can’t find sqljdbc_auth.dll in my system.  I did find sqljdbc.jar.  I am using weblogic 8.1 as my web server.   Any suggestions?

  6. The Javed Samsoud says:

    I have a particular problem with this driver. In fact, i use three webapp in the same instance of Tomcat Server. The surprise is that i can use only one webapps, the others throw the exception :

    com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication.

  7. dpblogs says:

    Hi Ray,

    Sorry for the late reply, regarding your question about not being able to find the sqljdbc_auth.dll, the DLL is usually installed in the "auth" sub-directory where you found the sqljdbc.jar file.

    For example, if you downloaded the v1.2 English driver, the installed directory will look somelike like:

     sqljdbc_1.2enusqljdbc.jar

     sqljdbc_1.2enuauthx86sqljdbc_auth.dll

    HTH,

    Jimmy Wu

  8. Jay says:

    I have the same error as Javed Samsoud. I ahve three application in tomcat and when I start, I can use only one application, the other two are not working and I have a warning ATTENTION: Failed to load the sqljdbc_auth.dll and in the exception the message This driver is not configured for integrated authentication. appears. Pls help!

    Jay

  9. Mugunthan Mugundan - MSFT says:

    Have you tried the steps in the blog above ie putting the sqljdbc_auth.dll to the application directory or in the JVM library path?

  10. Kory says:

    Our application runs on both Windows and Linux, and we are getting the same warning about loading the sqljdbc_auth.dll on both platforms.  Installing the sqljdbc_auth.dll works great for Windows, but when we install the Linux driver we can’t find an equivalent sqljdbc_auth for Linux.  Does one exist?  

    By the way, we tried using the sqljdbc_auth.dll in the Linux install thinking that it had the same name but was compiled for Linux, but it doesn’t work.

  11. Mugunthan Mugundan - MSFT says:

    There is no version of the integrated authentication dll that will work from Linux. Currently integrated authentication is Windows only.

  12. john says:

    jay & javed –

    problem may be that you have multiple sqljdbc.jar’s each trying to classload sqljdbc_auth.dll, and the 2nd initialization fails.

    look at your installation – if you have multiple sqljdbc.jar files, combine them into a single place and see if that solves your problem.

  13. Roman says:

    Hi

    I have a general question

    I saw that everytime i execute this code, my jvm opens a completely new thread and closes it after the the executeQuery method returns

    I use the com.microsoft.sqlserver.jdbc driver for jdbc connection

    and teh connection is of type java.sql.Connection

    PreparedStatement pStmt = connnection.prepareStatement(sql);

    pStmt.setQueryTimeout(getRequestTimeOut());

    rs = pStmt.executeQuery();

    Is it actually ok that a thread is opened everytime, it seems a little strange to me? Can i prevent this somehow , and force it to run in the context of the same thread ? Maybe i am doing something wrong ?

    Thanks in advance.

    Roman

  14. dpblogs says:

    Hi Roman,

    You’re doing nothing wrong.  What you’re observing is artifact of the query timeout implementation.  When a statement is executed with a query timeout, a separate thread is used to monitor the timeout and to terminate the query if the timeout lapses before the query finishes execution on its original thread.  While the behavior is expected in the current implementation, we recognize that a separate monitor thread may be somewhat heavy and that the number of concurrently executing statements with query timeouts could be limited by the number of concurrent threads a VM can support.  We are looking at ways to improve the query timeout implementation in a future release of the driver.  Until then we recommend using query timeouts only when executing statements where there is a reasonable chance that execution could time out.

    Regards,

    –David Olix [SQL Server]

  15. Millad says:

    First, thank you for the fix. It works only when I’m running it in a class as a Java Application. But when I use the same class in a servlet, I get

    com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit>

       WARNING: Failed to load the sqljdbc_auth.dll

    I have placed the sqljdbc_auth.dll file in the main project dir, which did work on a regular class but not when used with a servlet.

  16. Mugunthan Mugundan [MSFT] says:

    I would look at how to setup the class path for your particular application server. The application servers class path may be different from your standard java vm path.

  17. jagooch says:

    Could someone give an example of what the connection string should look like? I notice a post above has "integratedSecurity" in the string, but it looks like it is cut off.

    I am setting this up in java withouth any assitance, so a more complete example would be helpful.

  18. dpblogs says:

    Hey jagooch,

    Does this work for you? Please notice that I’m assuming you’re using a local instance, please change this information as appropriate.

    Connection conn = DriverManager.getConnection("jdbc:sqlserver://;serverName=localhost;integratedSecurity=true;database=archive");

    HTH

  19. bryabd says:

    I have tried every possible solution listed in hundreds of sites with no luck. I can log in with the same credentials through SSMSE with no problem. If I use integratedSecurity=false; then I get "This user is not associated with a trusted SQL Server connection". If I use integratedSecurity=true; then I get the following:

    May 8, 2009 6:42:24 PM com.microsoft.sqlserver.jdbc.SQLServerConnection SSPIData

    WARNING: ConnectionID:1 Authentication failed code-2146893052

    May 8, 2009 6:42:26 PM com.microsoft.sqlserver.jdbc.AuthenticationJNI SNISecGenClientContext

    WARNING: InitializeSecurityContext failed with -2146893052{WINERR}

    This repeats for a few seconds and it tells me the driver is not configured for authentication.

    I have tried many different things. I have copies of the DLL located in many different areas with no changes to these errors. Any help would be great!

  20. brybad says:

    Never mind! My SQL install was not mixed authentication. I used VPN to another server and had no problems with logging in.

  21. TCP/IP connection says:

    I received the above mentioned error when i tried to execute java program used for connection with SQL. plz mail the possibilities to remove this error to

    talk2shreyasb@gmail.com.

  22. gundala says:

    Anyone else has a solution for this. I also have same problem integrated security=true then i get This driver is not configured for integrated authentication. otherwise user error. Any help Thanks

  23. dpblogs says:

    Gundala,

    Have you tried the tips above? Are you on Windows? Try to copy the sqljdbc_auth.dll to a directory in the local directory where you are executing your application. See if you still receive your error.

    — Tres London [SQL Server]

  24. Carlos says:

    Tried to use sqljdbc.jar in a Sparc Solaris..

    Throws the same message, but can’t use a x86 dll.

    Where can I find the proper Driver?

  25. dpblogs says:

    Hey Carlos,

    The Windows Authentication feature only works from Windows. We don’t yet have a non Windows authentication feature.

    –Tres London [SQL Server]

  26. Btreksql says:

    Hi,

    I need help,

    I’m trying to connect to ms sql2005 database from remote

    computer all using windows xp. I have no problems running my software in local computer connecting to the ms sql2005 database. However, when i try to connect from remote computer to the ms sql2005 database computer i encounter this error:

    java.lang.classnotfoundexception

    com.microsoft.sqlserver.jdbc.SQLServeDriver

    I dont have ms sql2005 instal in the remote computer.but i have sqljdbc.jar in the remote computer. i try to set the classpath C:Program FilesSMCPLBTreklibsqljdbc.jar

    also in vain still getting the same error. Pls help. Thanks

  27. Nadir says:

    Hi,

    I’m running app on tomcat, i have sqljdbc.jar on classpath, sqljdbc_auth.dll on system path and on java.library.path (can list it on runtime) but i’m still cannot load the dll file (running System.loadLibrary("sqljdbc_auth.dll") throws UnsatisfiedLinkError. Any ideas? Im using win2k3 server sp2.

  28. Nadir says:

    Ah, forgot to mention – i’m using driver version 2.0 and java 32 bit. I got the proper sqljdbc_auth.dll (from driver.jar/sqljdbc_2.0/enu/auth/x86 folder)

  29. Tony Stevens says:

    I am also getting the Failed to load the sqljdbc_auth.dll warning message.

    There has to be a simple fix apart to this.

    I have put the sqljdbc_auth.dll in my

    C:WindowsSystem32sqljdbc_auth.dll

    Then as we all do leave logig behind in the hack an slash method added it to my tomcat lib folder, tomcat bin folder added the following to my tomcat startup.bat

    set JAVA_OPTS=-Djava.library.path=C:WindowsSystem32sqljdbc_auth.dll

    Added it to my system class path.

    Not sure what else I can do unless there is some m,agic I will happily learn

  30. Jake1164 says:

    I ran into this same issue and the short answer was as follows:

    1) Download the latest driver

    2) Install as per Microsoft Instructions

    3) Open PA Database Connection Manager

    4) Click on JDBC Drivers…

    5) Add new copy propertys from SQL Server 2008

    6) Click on Add Jar… and select the above installed file (from M$).

    7) Click on old driver and click Remove Jar

    8) Test (worked fine after this).

  31. Raghu says:

    I am trying to connect to SQL server 2008 from within Eclipse. However, I keep getting the message "failed to load sqljdbc_auth.dll. I have this file set in the system Path, eclipse path. The file has been copied to multiple system and application folders, but to no good. Can somebody suggest me steps one by one to configure Eclipse to log on to SQL server 2008?

    Thanks

    Raghu

  32. Tim says:

    I Microsoft SQL Server JDBC Driver 3.0 on a client machine running WIn7 64bit and I am using Window Server 2008. I am using NT authentication.  Sometimes I get connected to the database with no problem other times I get the following intermittent error:

    com.microsoft.sqlserver.jdbc.SQLServerConnection SSPIData

    WARNING: ConnectionID:46 Authentication failed code-2146892976

    with the message "This driver is not configured for integrated authentication"

    Inevitably I reboot the client machine or restart the client application, which seems to increase the odds of a connection being established.

    jdbc:sqlserver://<my sql server IP address>;database=qai;integratedSecurity=true;

    Not sure why?

    Is this just related to a time-out or a path issue? does anyone have any ideas?

    Should I force the login timeout to be longer?

  33. Tim says:

    I Microsoft SQL Server JDBC Driver 3.0 on a client machine running WIn7 64bit and I am using Window Server 2008. I am using NT authentication.  Sometimes I get connected to the database with no problem other times I get the following intermittent error:

    com.microsoft.sqlserver.jdbc.SQLServerConnection SSPIData

    WARNING: ConnectionID:46 Authentication failed code-2146892976

    with the message "This driver is not configured for integrated authentication"

    Inevitably I reboot the client machine or restart the client application, which seems to increase the odds of a connection being established.

    jdbc:sqlserver://<my sql server IP address>;database=qai;integratedSecurity=true;

    Not sure why?

    Is this just related to a time-out or a path issue? does anyone have any ideas?

    Should I force the login timeout to be longer?

  34. Cristóbal Herrera Jara. says:

    Señores:

    Yo trabajé con la herramienta Rational Functional Tester V.7 en base a el IDE Eclipse y realice la conexión con el MS SQL Server 2008 R2, antes que todo descargue el archivo indicado en todos los blog de MS, para la versión MS SQL Server 2008 R2  conector JDBC. 3.0 de todas formas siempre puedes usar el sqljdbc.jar, donde encontraras la .dll necesaria nombrada "sqljdbc_auth.dll", recuerda chequear la versión para tu procesador, X86(32 Bits),  64 Bits y otra extra que aparece.

    La mejor opción es copiar el archivo .dll

    Solución:

    C:Window

    y listo, estará todo Ok.

    Puedes realizar la prueba ahora, el String de conexión que use fue este:

    String url = "jdbc:sqlserver://localhost;databaseName=Mydatabase;integratedSecurity=true;";

    locahost = nombre del servidor.

    databaseName= nombre de tu base de datos.

    integratedSecurity=true; indica que ingresara con la "Autenticación Window".

    Que Dios los bendiga.

    Cristóbal Ramón Herrera Jara

    "Write once, run anywhere"

  35. Santhosh B says:

    I ran my Java program using the below statement. It worked fine for me.

    java -cp .;"C:Program FilesMicrosoft SQL ServerMSSQL10_50.SQLEXPRESSMSSQLMicrosoft SQL Server JDBC Driver 3.0sqljdbc_3.0enusqljdbc4.jar" -Djava.library.path="C:Program FilesMicrosoft SQL ServerMSSQL10_50.SQLEXPRESSMSSQLMicrosoft SQL Server JDBC Driver 3.0sqljdbc_3.0enuauthx86" DBCon

    Thanks

    ———————————

    Santhosh B

  36. Murat says:

    Hello,

    Thank you so much for the instructions. I've been trying for days connect to database and finally did it!

    Regards

  37. Jose Tepedino says:

    Thanks, that was very useful!

    I was just about to give up trying to connect via jdbc to SQL Server Express 2012 when I found your page, now I can proceed testing it.

  38. german says:

    please help me

    i get the following error

    but it was working before 2 days

    Oct 23, 2014 3:39:23 PM com.microsoft.sqlserver.jdbc.AuthenticationJNI GenerateClientContext

    WARNING: com.microsoft.sqlserver.jdbc.AuthenticationJNI@3e96cf Authentication failed code : -2146893052

    com.microsoft.sqlserver.jdbc.SQLServerException: Integrated authentication failed. ClientConnectionId:3cc62292-e44e-4902-9a7a-27efddec5d16

    Oct 23, 2014 3:39:23 PM org.apache.catalina.core.StandardWrapperValve invoke

    SEVERE: Servlet.service() for servlet jsp threw exception

  39. lara says:

    i am using netbeans 6.9 and sql server 2005 driver also jdbc 3.0 when i am connecting getting the error "this driver is not configured for integrated Authentication" ple help me rectify this problem……..

  40. ahmed says:

    Hi , i am trying to connect to sql server from my linux machine using integrated security=true. i get below error, could you please help.

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

    15/10/28 02:58:24 ERROR manager.SqlManager: Error executing statement: com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication