Sun JDBC ODBC 驱动程序或 MSSQL JDBC 驱动程序
我们有两种方法连接到 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Sun 的桥接驱动程序不应用于原型设计和快速开发以外的任何用途。
您应该始终使用 IV 型 JDBC 驱动程序(如果有)。我知道 SQL Server 有两个版本:Microsoft 版本 和 jTDS。
甚至 Sun/Oracle 也这么说。这是来自他们的文档:
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:
使用 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).
还有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.