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

标签 sql-server jdbc

我正在尝试使用 Microsoft 的 SQL Server 2005 的 JDBC 驱动程序连接到我公司的 SQL 服务器。我的连接字符串如下所示:

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

驱动程序抛出异常:

Invalid integratedSecurity property value:true

使用“yes”会给出不同的错误消息,指示“yes”不是 bool 属性的有效选项。

如何使用集成安全性进行连接?

最佳答案

检查这些instructions ,另外 - 您是否在同一个域中(调用者和服务器?)

引自那里:

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

关于sql-server - 如何使用 JDBC 驱动程序的集成安全性连接到 SQL Server?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4629718/

相关文章:

java - 如何使用 Microsoft JDBC 驱动程序获取 Velocity 从数据源检索模板?

java - 如何为 jdbc 模拟上下文数据源

node.js - 将 typeorm 中的 bigints 保存到 SQL Server 数据库 - 参数 '0' 的验证失败。值必须介于 -2147483648 和 2147483647 之间(含)

SQL Server 奇怪的多列分组场景和 OR

sql-server - 查询性能 - INNER Join 过滤

java - java连接DB2的问题

Java - 结果集 getString() 不一致

sql-server - 使用 terraform 添加 azure SQL Server 登录名

.net - 为什么 ToUpper 会导致 Entity Framework 5.0 切换到 Unicode?

java - 通过 Eclipse 连接到远程 Cassandra 数据库