且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用集成安全性和JDBC驱动程序连接到SQL Server?

更新时间:2022-11-17 11:12:39

检查这些

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

从那里报价:

JDBC驱动程序通过IntegratedSecurity连接字符串属性支持在Windows操作系统上使用Type 2集成身份验证.要使用集成身份验证,请将sqljdbc_auth.dll文件复制到安装了JDBC驱动程序的计算机上Windows系统路径上的目录中.

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.

sqljdbc_auth.dll文件安装在以下位置:

The sqljdbc_auth.dll files are installed in the following location:

<installation directory>\sqljdbc_<version>\<language>\auth\

注意:

如果您正在运行32位Java虚拟机(JVM),请使用 x86中的sqljdbc_auth.dll文件 文件夹,即使是操作系统 是x64版本.如果您正在跑步 在x64处理器上使用64位JVM,请使用 x64中的sqljdbc_auth.dll文件 文件夹.如果运行的是64位 IA-64处理器上的JVM,请使用 IA64中的sqljdbc_auth.dll文件 文件夹.

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.

或者,您可以设置java.libary.path系统属性来指定sqljdbc_auth.dll的目录.例如,如果JDBC驱动程序安装在默认目录中,则可以在启动Java应用程序时使用以下虚拟机(VM)参数指定DLL的位置:

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