12

I'm trying to connect to my company's SQL server using Microsoft's JDBC driver for SQL Server 2005. This is what my connection string looks like:

jdbc:sqlserver://HOSTNAME;integratedSecurity=true;database=DATABASE;

To which the driver throws an exception:

Invalid integratedSecurity property value:true

Using "yes" instead gives a different error message that indicates "yes" is not a valid option for a boolean property.

How do you connect using integrated security?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
zneak
  • 134,922
  • 42
  • 253
  • 328
  • Is sqljdbc_auth.dll in your bin/lib folder? – jason saldo Jan 07 '11 at 20:04
  • @jms Fun story: that's actually hard to tell. For some mysterious reason, I don't have the privileges to list the contents of the JDBC driver directories, but I can access the files inside using their path. – zneak Jan 07 '11 at 20:14
  • @jms There was no `auth` directory in the JDBC driver we had. Just got version 3.0 (instead of the 1.0 that comes up first when you google it). I suppose it's gonna be better. – zneak Jan 07 '11 at 21:38

1 Answers1

15

Check these instructions, also - are you on the same domain (caller and server?)

Quoting from there:

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:

If you are running a 32-bit Java Virtual Machine (JVM), use the sqljdbc_auth.dll file in the x86 folder, even if the operating system is the x64 version. If you are running a 64-bit JVM on a x64 processor, use the sqljdbc_auth.dll file in the x64 folder. If you are running a 64-bit JVM on a IA-64 processor, use the sqljdbc_auth.dll file in the IA64 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
Vegas
  • 8,017
  • 1
  • 10
  • 14
Dani
  • 14,639
  • 11
  • 62
  • 110
  • Turns out the JDBC driver Google shows first is severely outdated. I upgraded and followed the instructions and it worked perfectly. – zneak Jan 07 '11 at 21:47