如何使用集成安全性和JDBC驱动程序连接到SQL Server? [英] How can I connect to SQL Server using integrated security with the JDBC driver?

查看:158
本文介绍了如何使用集成安全性和JDBC驱动程序连接到SQL Server?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Microsoft的SQL Server 2005 JDBC驱动程序连接到公司的SQL Server.这是我的连接字符串:

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

使用"yes"会给出另一条错误消息,指示"yes"不是布尔型属性的有效选项.

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?

推荐答案

检查这些

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

这篇关于如何使用集成安全性和JDBC驱动程序连接到SQL Server?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆