问题描述
嘿我无法使用在Linux上运行的Java代码连接到SQL Server。
Hey I am having trouble connecting to an SQL Server with Java code that is running on Linux.
如果我设置 integratedSecurity = true
,然后java代码失败并出现以下错误:
If I set integratedSecurity=true
, then the java code fails with the following error:
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上的c $ c> sqljdbc.dll 文件。
which makes sense as there will be no sqljdbc.dll
file on Linux.
但如果我设置 integratedSecurity = false
,然后我收到以下错误:
But if I set integratedSecurity=false
, then I get the following error:
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'IT_DEV_USER'.
所以有人知道如何使用 integratedSecurity连接到SQL Server
设置为false? (请注意,当 integratedSecurity
设置为false时,我甚至无法在Windows上运行Java代码时进行连接。)
So does anyone know how I can connect to SQL Server with integratedSecurity
set to false? (Note that I cant even connect when the Java code is running on Windows when integratedSecurity
is set to false.)
如果没有,有什么方法可以在Linux上使用 integratedSecurity
吗?
If not, is there any way I can get integratedSecurity
working on Linux?
推荐答案
如果要使用集成安全性并使用JDBC Driver 4.0或更高版本,则在jdbc连接字符串中添加以下内容。
If you want to use integrated security and using JDBC Driver 4.0 or greater then you add the following in your jdbc connection string.
integratedSecurity=true;authenticationScheme=JavaKerberos
更多信息:
这篇关于使用integratedSecurity(Windows身份验证)通过JDBC从Linux连接到SQL Server?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!