通过JDBC从Linux机器通过Windows身份验证连接到SQL Server [英] Connect To SQL Server With Windows Authentication From A Linux Machine Through JDBC

查看:694
本文介绍了通过JDBC从Linux机器通过Windows身份验证连接到SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够使用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屋!

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