从jTDS JDBC驱动程序迁移到Microsoft JDBC [英] Migrating from jTDS JDBC driver to Microsoft JDBC

查看:122
本文介绍了从jTDS JDBC驱动程序迁移到Microsoft JDBC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Microsoft最近发布了一个新的JDBC驱动程序(版本6.0.7507.100),其中包含一些非常有趣的功能.我对TVP功能最感兴趣.这就是为什么我想用Microsoft驱动程序替换当前的jTDS驱动程序.

Microsoft has recently released a new JDBC driver (version 6.0.7507.100) with some very interesting features. I am mostly interested in the TVP feature. This is why I would like to replace the current jTDS driver with the Microsoft driver.

尝试登录我们的生产服务器时出现问题.假设我们使用域用户"mydomain \ dbuser"登录到sql服务器实例.这是到目前为止我们使用的jtds jdbc网址:

The problem arises when trying to log in to our production server. Lets say we use the domain user "mydomain\dbuser" to login to the sql server instance. This is the jtds jdbc url we have used so far:

jdbc:jtds:sqlserver:/sqlServer:1433/myDb;domain=mydomain;user=dbuser;password=secretPwd

它就像一种魅力.

但是,当我尝试使用Microsoft驱动程序时,我的应用程序无法建立与数据库的连接.我尝试了以下URL字符串:

But when I try to use the Microsoft driver, my application cannot establish a connection to the database. I tried the following URL strings:

jdbc:sqlserver://sqlServer:1433;database=myDb;username=dbuser;password=secretPwd
jdbc:sqlserver://sqlServer:1433;database=myDb;username=mydomain\dbuser;password=secretPwd
jdbc:sqlserver://sqlServer:1433;database=myDb;username=dbuser@mydomain;password=secretPwd

和许多其他排列,但没有成功.该应用程序失败,但出现以下异常:

and many other permutations but with no success. The app fails with the following exception:

com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'mydomain\dbuser'

在SQL Server日志中,出现以下错误:

in the SQL Server log we get the following error:

Login failed for user 'mydomain\dbuser'. Reason: Attempting to use an NT account name with SQL Server Authentication. [CLIENT: 10.10.10.10]

请注意,该应用程序应该在Linux下运行.

Note that the application is supposed to run under Linux.

有人知道作为域用户连接时Microsoft JDBC URL的外观吗?

Does anybody know how the Microsoft JDBC URL should look like when connecting as a domain user?

推荐答案

我在此问题上的研究使我得出以下结论:

My research in this issue has led me to the following conclusions:

  • 按照我在问题中的意图,不可能从jTDS驱动程序向Microsoft驱动程序进行简单转换.这是因为jTDS驱动程序实现了Microsoft驱动程序上不可用的NTLM身份验证.
  • 一种替代方法是使用Linux机器上可用的JavaKerberos身份验证方案(如Gord Thomson所建议的).幸运的是,我们已经在生产环境中建立了Kerberos基础结构.

我主要在以下Microsoft(博客)帖子的帮助下成功地在服务中添加了Kerberos身份验证:

I have successfuly managed to add Kerberos authentication in my service mainly with the help of these Microsoft (blog) posts:

所以我将使用它.

这篇关于从jTDS JDBC驱动程序迁移到Microsoft JDBC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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