Welcome to MSDN Blogs Sign in | Join | Help

Microsoft JDBC Driver Team Blog

Discussions related to Microsoft JDBC driver.
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

Posted: Monday, June 18, 2007 3:17 PM by dpblogs
Filed under:

Comments

Adrien said:

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

# July 27, 2007 7:35 AM

dpblogs said:

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

# July 30, 2007 3:46 AM

Yash Giri said:

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

# February 13, 2008 6:17 AM

dpblogs said:

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

# February 13, 2008 9:10 PM

Ray said:

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?

# April 14, 2008 2:43 PM

The Javed Samsoud said:

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.

# June 5, 2008 9:06 AM

dpblogs said:

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.2\enu\sqljdbc.jar

 sqljdbc_1.2\enu\auth\x86\sqljdbc_auth.dll

HTH,

Jimmy Wu

# June 25, 2008 5:08 PM

Jay said:

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

# August 5, 2008 5:04 AM

Mugunthan Mugundan - MSFT said:

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?

# August 5, 2008 11:59 AM

Kory said:

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.

# August 8, 2008 12:42 PM

Mugunthan Mugundan - MSFT said:

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

# August 8, 2008 12:50 PM

john said:

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.

# November 14, 2008 12:04 AM

Roman said:

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

# March 8, 2009 10:35 AM

dpblogs said:

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]

# March 11, 2009 7:37 PM

Millad said:

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.

# April 10, 2009 7:30 PM

Mugunthan Mugundan [MSFT] said:

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.

# April 14, 2009 7:03 PM

jagooch said:

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.

# April 27, 2009 1:42 PM

dpblogs said:

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

# April 27, 2009 4:09 PM

bryabd said:

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!

# May 8, 2009 9:47 PM

brybad said:

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

# May 8, 2009 10:13 PM

TCP/IP connection said:

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.

# May 27, 2009 6:21 AM

gundala said:

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

# August 14, 2009 2:22 PM

dpblogs said:

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]

# August 25, 2009 8:46 PM

Carlos said:

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?

# September 10, 2009 4:43 PM

dpblogs said:

Hey Carlos,

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

--Tres London [SQL Server]

# September 15, 2009 5:37 PM

Btreksql said:

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 Files\SMCPL\BTrek\lib\sqljdbc.jar

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

# November 16, 2009 7:00 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker