通过 JDBC 从 Linux 机器使用 Windows 身份验证连接到 SQL Server [英] Connect To SQL Server With Windows Authentication From A Linux Machine Through JDBC
问题描述
我希望能够使用 jdbc 和 windows 身份验证连接到 SQL Server.我在互联网上看到一些答案说我应该将以下属性添加到连接字符串中:
I want to be able to connect to a SQL Server using jdbc and windows authentication. I saw some answers on the internet saying i should add the following property to the connection string:
integratedSecurity=true;
还要加上
sqljdbc_auth.dll
到java路径.
但是,据我所知,仅当我从 Windows 机器连接时才适用.当我在 Linux 机器上尝试这个时,我得到:
But this, as far as i understand applies only when i'm connecting from a Windows machine. When i try this on a Linux machine i get:
java.sql.SQLException: This driver is not configured for integrated authentication
我的问题是如何在 Linux 机器上执行此操作.
My question is how do I do it from a Linux machine.
谢谢
推荐答案
好吧,最终我会回答我自己的问题:这无法从使用 Microsoft JDBC 驱动程序的 linux 机器使用 Windows 身份验证.这可以通过使用以下连接字符串的 jTDS JDBC 驱动程序实现:
Well, eventually I answer my own question: This is not possible to use Windows authentication from a linux machine using the Microsoft JDBC driver. This is possible using the jTDS JDBC driver using the following connection string:
jdbc:jtds:sqlserver://host:port;databaseName=dbname;domain=domainName;useNTLMv2=true;
谢谢大家的评论
这篇关于通过 JDBC 从 Linux 机器使用 Windows 身份验证连接到 SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!