none
Can't get IntegratedSecurity with JDBC driver

    Question

  • Hi;

    I used SQLServerDatabaseMetaData (which requires a connection to return this data which seems unnecessary) to get:

    name: Microsoft SQL Server 2005 JDBC Driver
    version: 1.1.1501.101
    Passing a url of: jdbc:sqlserver://localhost:1433;DatabaseName=Northwind;IntegratedSecurity=true

    I get the error:
    Oct 7, 2006 3:46:09 PM com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit>
    WARNING: Failed to load the sqljdbc_auth.dll
    Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication.

    I copied over x86\sqljdbc_auth.dll and then it worked. I assume this is required with the jar file. This leads to a couple of questions:

    1. What are the files xa\x86\sqljdbc_xa.dll & x64 files for? Are they needed?
    2. The jar file can just travel with my java code. Should the dll do the same or does it need to be in the path and/or the default directory?
    3. Are there any other files needed or just these two?

    thanks - dave

    Saturday, October 07, 2006 9:49 PM

Answers

  • sqljdbc_xa dll is for xa transactions. YOu do not need them if you are not using XA transactions.

    The intgrated auth dll is required (sqljdbc_auth.dll) if you are using integrated authentication. See the links raj provided to see where to place this dll.

    Those are the only two files outside of the jar.

    Tuesday, October 10, 2006 8:37 PM
  • Does the instructions at http://msdn2.microsoft.com/en-us/library/ms378428.aspx help. I'll copy them on this post to relieve some of the confusion. Please pay particular attention to the last suggestion about using the –Djava.library.path explicitly. This will allow you to put the dll in one location on your computer and then point the java executable to it such as:

    Java.exe –Djava.libary.path="C:\jdbc\" HelloWorld

    In the above example the dll will be in the C:\jdbc\ directory and your application is called HelloWorld.

     ________________________________________________________________________

    Connecting with Integrated Authentication

    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.

    The sqljdbc_auth.dll files are installed in the following location:

    <installation directory>\sqljdbc_<version>\<language>\auth\

    Note: On a 32-bit processor, use the sqljdbc_auth.dll file in the x86 folder. On a 64-bit processor, use the sqljdbc_auth.dll file in the x64 folder.

    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:\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_<version>\enu\auth\x86

     

    Regards,

    Jaaved Mohammed

     

    Thursday, January 25, 2007 1:45 AM
  •  

    This is a known issue. We will fix this in the upcoming 1.2 release.
    Tuesday, August 28, 2007 8:39 PM
  •  

    Please ignore my earlier post.

     

    With the sqljdbc_auth.dll, it works in ver 1.2 JDBC driver

     

    MP

     

     

    Monday, November 12, 2007 6:30 PM

All replies

  • sqljdbc_xa dll is for xa transactions. YOu do not need them if you are not using XA transactions.

    The intgrated auth dll is required (sqljdbc_auth.dll) if you are using integrated authentication. See the links raj provided to see where to place this dll.

    Those are the only two files outside of the jar.

    Tuesday, October 10, 2006 8:37 PM
  • I am working on the windows authentication on a windows 2003 server. So i used the 64 sqljdbs_auth.dll  and rebooted . I still get "WARNING: Failed to load the sqljdbc_auth.dll" and i cannot do a windows authnetication.

    I do have the dll in the system pth adn have copied the dll to C:\windows\system32 as well. Any ideas?

    thanks!

     

    Friday, October 13, 2006 4:15 PM
  • Are you using 64 bits version of windows 2003?
    Tuesday, October 31, 2006 4:28 AM
  • Hi, Dave,

    Where did you copy the sqljdbc_auth.dll?  The directions say to "copy the file to a directory on the Windows system path on the computer where the JDBC driver is installed."  The statement confuses me a little.  Did you copy the file to a specific location or just any location that happens to be in the path?

    Thanks,

    Stephanie

    Thursday, November 09, 2006 1:43 PM
  • I copied it to the same directory as the jar file.
    Thursday, November 09, 2006 2:43 PM
  • I've copied these dll's all over the file system (including WINNT, system32, and the directory the jar file is in) and I still get WARNING: Failed to load the sqljdbc_auth.dll
    Is there a call to the object you can make to get this file to load?

    Paul
    Friday, January 19, 2007 2:20 PM
  • The reason I asked about making an object call is because of the error statement I get that reads:
    SQLException: This driver is not configured for integrated authentication.

    How might I configure it?
    My connection string is just
    "jdbc:sqlserver://serverName:1433;integratedSecurity=true;"
    Friday, January 19, 2007 4:36 PM
  • Does the instructions at http://msdn2.microsoft.com/en-us/library/ms378428.aspx help. I'll copy them on this post to relieve some of the confusion. Please pay particular attention to the last suggestion about using the –Djava.library.path explicitly. This will allow you to put the dll in one location on your computer and then point the java executable to it such as:

    Java.exe –Djava.libary.path="C:\jdbc\" HelloWorld

    In the above example the dll will be in the C:\jdbc\ directory and your application is called HelloWorld.

     ________________________________________________________________________

    Connecting with Integrated Authentication

    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.

    The sqljdbc_auth.dll files are installed in the following location:

    <installation directory>\sqljdbc_<version>\<language>\auth\

    Note: On a 32-bit processor, use the sqljdbc_auth.dll file in the x86 folder. On a 64-bit processor, use the sqljdbc_auth.dll file in the x64 folder.

    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:\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_<version>\enu\auth\x86

     

    Regards,

    Jaaved Mohammed

     

    Thursday, January 25, 2007 1:45 AM
  • Hi,

        My sqljdbc.jar is located in the following directory

    C:\Program Files\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.1\enu

     And I copied x86 directory from C:\Program Files\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.1\enu\auth

      And used following steps to establish database connection

         Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
         String connectionUrl = "jdbc:sqlserver://localhost:1433;IntegratedSecurity=true;";
         Connection con = DriverManager.getConnection(connectionUrl);

     

    and getting the following error

    Mar 26, 2007 12:51:50 PM com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit>
    WARNING: Failed to load the sqljdbc_auth.dll
    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 java.sql.DriverManager.getConnection(DriverManager.java:512)
     at java.sql.DriverManager.getConnection(DriverManager.java:193)
     at testproject.JdbcDriverTest.main(JdbcDriverTest.java:60)

    Please help me out in fixing this issue.

    Thanks

    Purnima

     


     

     

     

     

    Monday, March 26, 2007 5:58 PM
  • Purnima,

    Did you try the recommendations that I gave above. Did you copy the entire x86 directory to the new location or just the contents of the x86 directory?

    Thanks,

    Jaaved Mohammed [MSFT]

    Monday, March 26, 2007 8:49 PM
  • I copied entire x86 dierctory to the new location.

     

    Thanks

    Purnima

    Tuesday, March 27, 2007 1:13 PM
  • hi denial

     i am getting same problem and unable to

    sort the error

    will u please tell me how to sort out this probl,me

    where exactle i have to copy sqljdbc_auth.dll.

     

     

    pleasse replay soon

     

    Thursday, June 14, 2007 1:54 PM
  • I follow the instruction in connection sample and add the dll path to java command to avoid sqljdbc_auth.dll cannot load error but I got the wrong data. I am using Windows XP SP2 PRO and SQL Server 2005 which is installed in Windows 2003 Server.

    connect.java is my filename that i used to test the jdbc connection.
    I compiled the connect.java successfully without error but when I run it using java command I got this funny output.

    C:\>java -Djava.library.path=C:\Java\tools\sql2005jdbc\sqljdbc_1.2\enu\auth\x86 connect
    0E-20
    0E-20
    0E-20
    0E-20
    0E-20
    0E-20
    0E-20
    0E-20
    0E-20
    0E-20
    0E-20
    0E-20
    0E-20

    Please help with this error.
    Friday, August 24, 2007 10:04 AM
  • I work for an ISV.  I don't want to use integrated security.  I am connecting from a Tomcat servlet with a URL of jdbcTongue Tiedqlserver://localhost:2005;DatabaseName=bpx;User=sa;Password=<pw> and am getting the warning message “Failed to load the sqljdbc_auth.dll” on startup since I switched locally to the Microsoft 1.2 beta JDBC driver.  I would rather not deliver the DLL since we don't use Windows authentication from our application.

     

    That is funny that part of the URL gets turned into a emoticon!

    Tuesday, August 28, 2007 5:15 AM
  •  

    This is a known issue. We will fix this in the upcoming 1.2 release.
    Tuesday, August 28, 2007 8:39 PM
  • We can ignore it, then?  The effect is benign?

     

    Wednesday, August 29, 2007 12:30 AM
  •  

    This warning message in the APR CTP release of the SQL Server 2005 JDBC v1.2 driver is overly active.  Yes, you can safely ignore this warning message if you are running the APR CTP (CTP1) driver.

     

    Jimmy

    Saturday, September 01, 2007 12:37 AM
  •  

    So was this issue fixed in 1.2 release ?

     

    a) I am having this error with the 1.2 JDBC driver

    b) I am looking at its release notes and dont see this mentioned.

     

    MP

    Monday, November 12, 2007 5:37 PM
  •  

    Please ignore my earlier post.

     

    With the sqljdbc_auth.dll, it works in ver 1.2 JDBC driver

     

    MP

     

     

    Monday, November 12, 2007 6:30 PM
  • I'm having this same issue and I can't seem to work out where I'm going wrong. 

     

    I have a Java application that works fine on a development workstation, which is Windows XP Pro (32-bit).  When I move to Windows Server 2003 R2 Enterprise x64, I can't get sqljdbc_auth.dll to load when running a 32-bit version of Java (and the corresponding x86 version of sqljdbc_auth.dll.  I've tried placing sqljdbc_auth.dll in the system32 directory (which is on the PATH) and using the -Djava.library.path on the Java command-line, but neither or those work.

     

    I tried running the Java application under a 64-bit JVM and the corresponding 64-bit sqljdbc_auth.dll and that works fine.  Unfortunately, the ultimate goal is to run the Java application within a 32-bit executable that dynamically loads the JVM, so I have to get the 32-bit version working.

     

    Any suggestions welcome.

    Wednesday, February 13, 2008 10:28 PM
  •  

    I've added the dll path to the class path. I've copied the directory of dll inside the system32 folder. I am still getting there error that the dll is not found. HELP!
    Friday, October 17, 2008 3:53 PM
  • Well
    In mi case i'm using jdeveloper on XP, so I put the
    <your_folder>/sqljdbc_2.0/enu/auth/x86/sqljdbc_auth.dll file in both folder:

    1.- <jdeveloper_home>j2ee\home\applib

    2.- <jdeveloper>\jdk\jre\lib\ext (if jdk is included)

    The sqljdbc.jar file is in this folders too.

    I hope it helps.

    Atte.

    Danlu

    Peruvian Developer
    Friday, October 24, 2008 6:00 AM
  • After installing the JDK I added C:\Program Files\Java\jdk1.6.0_12\bin to the path statement. This is the folder I copied the sqljdbc_auth.dll to inorder to successfully connect with integrated authentication.
    Wednesday, March 11, 2009 12:04 AM
  • Hello,

    I am getting the same error. It's working for one of my java application and another application it's not working.

    Tomcat 6.0, MS SQL 2005 Server, MSSQL2005 JDBC driver 1.2--

    1) Added .dll in Java/JDK/bin
    2) Added the above path in the System "Path" environment
    3) Added .dll in Windows\system32 which is also in System's 'Path' environment
    4) .jar in my application's lib fodler, in tomcat's lib folder.
    5) Added .dll and jar in <jdeveloper>\jdk\jre\lib\ext (if jdk is included)




    Thursday, April 30, 2009 2:30 PM
  • Got it working...

    1) Added .dll and .jar in Java/JDK/bin
    2) Added .jar in tomcat/lib
    3) Added .jar in applications/lib
    4) Added .dll in windows/system32

    add the java/jdk../bin and windows/system32 in "Path" system environment.
    Thursday, April 30, 2009 3:16 PM
  • Yes, it definitely worked after adding the .dll to the JAVA/JDK/bin directory.
    Saturday, August 08, 2009 12:29 AM
  •  I am using ms sql 2005 in eclipse.how can I give the path of x86 in eclipse.I cant understand the above example

    please tell  me the way please...........


    Tuesday, February 21, 2012 2:19 PM
  • I am not sure about the particular IDE... if you have an exception regarding to DLL file[no sqljdbc_auth in java.library.path]  the easiest way is

    1. go to [JDBC extracted folder ]\enu\auth\x64     [if you are 36 go to x86]
    2. copy the dll [sqljdbc_auth.dll] to your jdk bin  i.e :jdk1.6.0_31\bin

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

            try {
                Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
                Connection conn = DriverManager.getConnection(url);

    }catch (Exception e){

    //sorry for lazy err handling ;) 

         e.printStackTrace();

    }


    Wednesday, May 02, 2012 1:45 PM