48
votes

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?

11

11 Answers

25
votes

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.

33
votes

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

13
votes

                                                            Place .dll File In Your JRE Folder:-
I was also facing the same problem and after that I placed sqljdbc_auth.dll (x86 or x64) depending upon your operating system in JRE folder i.e jre7/bin/file.dll and then run my application.jar & it worked perfectly. This worked for me you can also try this may this also help's to you :)

10
votes

In my case, I did the following to resolve:

Downloaded the Microsoft JDBC Driver 8.2 for SQL Server (zip) (found here - https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver15).

Then in the zip file, I went into the following folders:

sqljdbc_8.2 > enu > auth > x64

and the copied "mssql-jdbc_auth-8.2.2.x64.dll" to C:\Program Files\Java\jdk-12.0.1\bin

7
votes

Download the jdbc driver (ver 7.2) from Microsoft and copy the sqljdbc_auth.dll to C:\Program Files\Java\jre\bin and C:\Program Files\Java\jdk\bin folder. You would go to Program Files (x86) folder if you're running Java 32-bit.

5
votes

i had faced same issue for the following windows authentication string

jdbc:sqlserver://host:1433;integratedSecurity=true

the default authenticationScheme=NativeAuthentication, So it might depends on some microsoft dlls. To fix it, the update authenticationScheme as NTLM as below

jdbc:sqlserver://host:1433;authenticationScheme=NTLM;integratedSecurity=true;domain=myDomain

note: username given was without domain

1
votes

i had a similar issue and i placed location of .dll file in pom.xml under

< configuration >

< argLine > -Djava.library.path="C:\*\\**"< argLine>

and that worked for me

1
votes

This worked for me:

Download Microsoft JDBC Driver for SQL Server and extract the content. There you will find a sqljdbc_auth.dll from Microsoft JDBC Driver x.x for SQL Server\sqljdbc_x.x\enu\auth\x64. Copy that file to the System32 folder of Windows.

Now test the connection.

1
votes

I have a slightly different take on the other answers here, both in terms or what file (name) may need to be copied to a special place, and where it should be copied. (It isn't ALWAYS going to be sqljdbc_auth.dll, and it isn't ALWAYS to be placed in the jre/bin of whatever is your public JRE. More follows.

First, in later versions of the MS SQL Server driver, I found that the filename is not sqljdbc_auth.dll but instead mssql-jdbc_auth-8.4.1.x64.dll (in a specific recent version, of course). As for the exact name of the file (and where to look for it if you don't yet have it), it would be whatever is found in the zip you downloaded from MS.

Specifically, in my case, that zip was sqljdbc_8.4.1.0_enu.zip, and the dll was found within that in sqljdbc_8.4\enu\auth\x64 (since I am running on 64-bit Windows and plan to implement the DLL within my 64-bit JVM).

Second, as for WHERE that file needed to be placed on my machine, while many people here understandably suggest placing it in such places as Windows system32 or the jre/bin of whatever is their public JRE (and tha tmay work for them), it did not work for me.

In my case, it's that the app server I am using (such as Tomcat) was configured to use a SPECIFIC JVM/JRE on my machine. And I needed to put this DLL into the jre/bin folder of THAT JVM (or just the bin folder, in case of Java 11 and above, which by default is implemented as a JRE).

Then restart your app server (or JVM).

0
votes

For anyone coming here because this error has appeared in their Cognos log, (cognosserver.log)

You need to copy the 64 bit version of sqljdbcauth.dll into D:\Program Files\IBM\Cognos\Analytics\bin64

You need to copy the 32 bit version of sqljdbcauth.dll into D:\Program Files\IBM\Cognos\Analytics\bin

When I upgraded a working install (11.1.3) to a newer version (11.1.7), it helpfully deleted these files.

The is of course not mentioned anywhere in the doco. It only talks about the install_location\drivers folder

0
votes

I have included c:\full-path\mssql-jdbc_auth-9.2.1.x64.dll in CLASSPATH ( windows environment ) this concept is similar to om.xml concept of using directive: -Djava.library.path="C:\*\\**"