Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I connect to SQL Server using integrated security with the JDBC driver?

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?

like image 350
zneak Avatar asked Jan 07 '11 19:01

zneak


1 Answers

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
like image 163
Dani Avatar answered Sep 28 '22 02:09

Dani