gpt4 book ai didi

java - 使用 integratedSecurity(Windows 身份验证)通过 JDBC 从 Linux 连接到 SQL Server?

转载 作者:IT王子 更新时间:2023-10-29 00:07:46 26 4
gpt4 key购买 nike

嘿,我无法使用在 Linux 上运行的 Java 代码连接到 SQL Server。

如果我设置 integratedSecurity=true,则 java 代码会失败并出现以下错误:

WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId:b030b480-453d-4007-8151-a552150f74cd

这是有道理的,因为在 Linux 上没有 sqljdbc.dll 文件。

但是,如果我设置 integratedSecurity=false,则会出现以下错误:

 com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'IT_DEV_USER'.

那么有人知道如何将 integratedSecurity 设置为 false 连接到 SQL Server 吗? (请注意,当 integratedSecurity 设置为 false 时,当 Java 代码在 Windows 上运行时,我什至无法连接。)

如果没有,有什么方法可以让 integratedSecurity 在 Linux 上运行?

最佳答案

如果您想使用集成安全并使用 JDBC 驱动程序 4.0 或更高版本,那么您可以在 jdbc 连接字符串中添加以下内容。

integratedSecurity=true;authenticationScheme=JavaKerberos

更多信息:http://blogs.msdn.com/b/psssql/archive/2015/01/09/jdbc-this-driver-is-not-configured-for-integrated-authentication.aspx

关于java - 使用 integratedSecurity(Windows 身份验证)通过 JDBC 从 Linux 连接到 SQL Server?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30914061/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com