Announcement and Discussions related to the Microsoft JDBC driver for SQL Server
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: GetDNSNameThis 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 ServerDisclaimer: This posting is provided "AS IS" with no warranties, and confers no rights
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?
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.
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 ...
>> 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.)
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)
... 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.
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.
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?
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.
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:
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!
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?
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.
There is no version of the integrated authentication dll that will work from Linux. Currently integrated authentication is Windows only.
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.
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);
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.
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.
--David Olix [SQL Server]
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
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.