Sun JDBC ODBC 驱动程序或 MSSQL JDBC 驱动程序

发布于 2024-11-19 23:19:11 字数 160 浏览 2 评论 0原文

我们有两种方法连接到 MSSQL 数据库,一种是 Sun JDBC ODBC 桥,另一种是 MSSQL JDBC 驱动程序。

我们正在进行一些重组,并希望采用统一的数据库连接方法。

我们应该使用哪个驱动程序? (我故意把这个问题放在一个非常广泛的层面上,我想听听人们的意见)

we have 2 approaches to connecting to our MSSQL databases, the one being the Sun JDBC ODBC bridge and the other being the MSSQL JDBC Driver.

We're doing some reorganization and want a uniform approach to database connectivty.

Which driver should we use?
(I'm leaving the question at a very broad level on purpose, I'd like to hear what peoples opinions are)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

憧憬巴黎街头的黎明 2024-11-26 23:19:11

Sun 的桥接驱动程序不应用于原型设计和快速开发以外的任何用途。

您应该始终使用 IV 型 JDBC 驱动程序(如果有)。我知道 SQL Server 有两个版本:Microsoft 版本jTDS

甚至 Sun/Oracle 也这么说。这是来自他们的文档

如果可能,请使用纯 Java JDBC 驱动程序而不是 Bridge 和
ODBC 驱动程序。这完全消除了客户端配置
ODBC 需要。它还消除了 Java VM
可能会被本机代码中的错误损坏
Bridge(即Bridge本机库、ODBC驱动管理器
库、ODBC 驱动程序库和数据库客户端库)。

建议在原型设计中使用 JDBC-ODBC Bridge 驱动程序
努力以及没有其他基于 JDBC 技术的驱动程序的情况
存在。如果有商业的、全 Java 的 JDBC 驱动程序可用,我们
建议使用它来代替 Bridge。

Sun's bridge driver shouldn't be used for anything other than prototyping and quick development.

You should always use a type IV JDBC driver if one's available. There are two that I know of for SQL Server: Microsoft's version and jTDS.

Even Sun/Oracle says so. This is from their docs:

If possible, use a Pure Java JDBC driver instead of the Bridge and an
ODBC driver. This completely eliminates the client configuration
required by ODBC. It also eliminates the potential that the Java VM
could be corrupted by an error in the native code brought in by the
Bridge (that is, the Bridge native library, the ODBC driver manager
library, the ODBC driver library, and the database client library).

The JDBC-ODBC Bridge driver is recommended for use in prototyping
efforts and for cases where no other JDBC technology-based driver
exists. If a commercial, all-Java JDBC driver is available, we
recommend that it be used instead of the Bridge.

謸气贵蔟 2024-11-26 23:19:11

使用 Microsoft 或jTDS 驱动程序。在撰写本文时,Microsoft 提供的 MSSQL JDBC 驱动程序为 3.0 版,尽管版本 4 已作为预览版提供。

避免使用 Sun JDBC ODBC 驱动程序,因为它实际上是连接到计算机中安装的 ODBC 驱动程序的桥梁。 StackOverflow 上至少有一个问题被问到为什么应该使用 Type 4 驱动程序而不是 Type 1(ODBC 桥)或类型 2(基于 JNI)驱动程序。

要添加到该问题中发布的答案,应避免使用类型 1(ODBC 驱动程序桥),除非您无法从供应商处找到 JDBC 驱动程序。毕竟,依赖供应商提供的 ODBC 驱动程序以及 Sun JDBC-ODBC 驱动程序没有任何商业意义。生产中遇到的任何错误都可能出现在其中。因此,如果您针对业务线应用程序做出此决定,则应该使用经过充分测试的第三方 JDBC 驱动程序(例如 jTDS 或 DataDirect)或供应商提供的驱动程序(除非您的经验表明驱动程序编写得不好或者供应商无法解决问题或提供足够的解决方法)时间跨度)。

Use the MSSQL Type 4 JDBC driver provide by Microsoft or the jTDS driver. At the time of writing this, the MSSQL JDBC driver offered by Microsoft is at version 3.0 although version 4 is available as a preview release.

Avoid the Sun JDBC ODBC driver, for it really is a bridge to the ODBC driver installed in the machine. Atleast one question has been asked on StackOverflow on why Type 4 drivers ought to be used as opposed to Type 1 (ODBC bridges) or Type 2 (JNI-based) drivers.

To add to the answers posted in that question, Type 1 (ODBC driver bridges) are to be avoided unless you cannot find a JDBC driver from the vendor. After all, it does not make any business sense to have dependencies on both the ODBC driver offered by the vendor, as well as the Sun JDBC-ODBC driver; any bug encountered in production could be in either. Therefore, if you are making this decision for a line-of-business application, you ought to be using a well-tested third-party JDBC driver (like jTDS or DataDirect) or the vendor provided driver (unless your experience suggests that the driver is poorly written or that the vendor is incapable of resolving issues or providing workarounds in a sufficient timespan).

独留℉清风醉 2024-11-26 23:19:11

还有OpenLink Multi-tier JDBC Driver for SQL Server...

该驱动程序在需要额外安全性和可配置性的地方占有一席之地。

There is also the OpenLink Multi-tier JDBC Driver for SQL Server...

This driver has its place - where additional security and configurability is required.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文