Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JDBC SQLServerException: "This driver is not configured for integrated authentication."

I am writing a "server-side extension" for SmartFoxServer (SFS). In my login script, I need to make a connection to MS SQL Server, which I am attempting to do using JDBC. I have tested the JDBC code in my debug environment, and it works fine.

BUT

When I put the server-side extension in the SFS "extensions" folder (as per spec), I'm getting a com.microsoft.sqlserver.jdbc.SQLServerException:

"This driver is not configured for integrated authentication.".

I Googled for this error, and found that it's usually because the file sqljdbc_auth.dll is not in the system path; I have copied this file into a folder in my system path, and still it does not work!

Any other suggestions?

like image 696
Shaul Behr Avatar asked May 22 '11 12:05

Shaul Behr


2 Answers

When using Windows Authentication Integrated Security

  1. Download the sqljdbc_6.0.8112.100_enu.exe from Microsoft Site
  2. Install the exe (read the instructions in the zip path)
  3. copy sqljdbc_4.0/enu/auth/x64/sqljdbc_auth.dll to

    Java/jre7/bin and to

    Java/jre7/lib

After this youj should be able to connect to hibernate tools to pull the database in Data Tools

like image 133
Pavan Avatar answered Oct 19 '22 15:10

Pavan


There are different versions of sqljdbc_auth.dll for different processor architectures (x86/x64/ia64). Which one are you using on your SFS server?

You must choose the one to match the architecture of the JVM under which SFS is running. So, if you're running 32-bit Java on a 64-bit machine, you'll need the x86 version, not the x64 version.

I've not used SFS before, so I don't know whether it writes any logs anywhere. If it does, it might be worth taking a look at these logs to see if anything helpful has been written to them.

EDIT: I can't be 100% sure that SFS is using 64-bit Java just because it runs out of C:\Program Files as opposed to C:\Program Files (x86).

I found the following line in the SFS docs under Introduction > Requirements and Installation. Whilst this line applies only to Linux as opposed to Windows, it might suggest that SFS on Windows also uses 32-bit Java:

Since version 1.5 SmartFoxServer comes with its own x86 32-bit Sun Java Runtime.

One quick way to determine which version(s) of Java you have installed is, give the following command in your cmd: Java -version

It will display the following to the console:

C:\Users\967097>java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

Here,you can see the bit type of the java version installed.

Does your application work if you use the x86 version of sqljdbc_auth.dll instead of the x64 version? If it suddenly starts working with the x86 DLL, then SFS must be using 32-bit Java.

Is there a batch-file used to start SFS? If so, reading through that might help point out where SFS is running Java from. Also look out for any changes to the PATH. Java can only load DLLs in the java.library.path system property, and on Windows, this is set to the value of the PATH environment variable.

If you still can't determine whether SFS is using 32-bit or 64-bit Java, try using Process Explorer to look at the environment that the java.exe process running SFS was started with.

like image 28
Luke Woodward Avatar answered Oct 19 '22 15:10

Luke Woodward