JDBC驱动程序类型1和2 [英] JDBC Driver type 1 and 2

查看:82
本文介绍了JDBC驱动程序类型1和2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我们不能在Web应用程序开发中使用JDBC Type 1(JDBC-ODBC Bridge驱动程序)和Type 2驱动程序.

Why we cannot use JDBC Type 1 (JDBC-ODBC Bridge driver) and type 2 driver for web application development.

这两个驱动程序需要一些客户端安装.

These two drivers requires some client side installation.

我对客户端感到困惑,因为当我们在服务器中安装所有特定于驱动程序的东西时,客户端又需要什么额外的东西.

I am confused about client ,because when we install all driver specific things in server then what extra things needed for client.

推荐答案

为什么我们不能在Web应用程序开发中使用JDBC Type 1(JDBC-ODBC Bridge驱动程序)和Type 2驱动程序.

Why we cannot use JDBC Type 1 (JDBC-ODBC Bridge driver) and type 2 driver for web application development.

没有什么可以阻止任何人在Web应用程序中使用Type 1和2驱动程序.但是,不建议这样做(请参见第三段).

There is nothing to prevent anyone from using Type 1 and 2 drivers in a web-application. It is however not recommended (see the third paragraph).

类型1和类型2驱动程序都不能跨平台移植.乍看之下这似乎不是问题,但最肯定的是.尤其是如果您的单元测试在一个平台上运行,而验收测试和生产环境是另一个平台.在一个环境中似乎成功的代码可能在另一个环境中失败.

Both Type 1 and Type 2 drivers are not portable across platforms. While this might not appear to be a problem at first glance, it most certainly is. Especially if your unit-tests are run on one platform, and your acceptance testing and production environments are another. Code that appears to succeed on one environment can fail in another.

但是,在Web应用程序中不使用它们的最重要原因是存在本机代码. 某些本地代码故障会导致JVM崩溃,这是普遍不喜欢的事情.毕竟,当Type 4驱动程序可以简单地断开连接并在故障后进行清理而不会影响应用程序的其余部分时,这将导致不必要的停机时间.

However, the most important reason for their non-usage in web applications is the presence of native code. Certain failures in native code, will result in JVM crashes, and that is something that is disliked universally. After all, it will result in unnecessary downtime, when a Type 4 driver could have simply dropped the connection and cleaned up after the failure, without affecting the rest of the application.

就客户端设置而言,通常客户端安装取决于所用驱动程序的类型.类型1驱动程序实际上包装了另一个数据库API(例如ODBC),因此也需要相应的ODBC驱动程序进行设置.类型2驱动程序要求DLL或共享对象出现在java.library.path中,通常这是通过设置PATH或LD_LIBRARY_PATH环境变量来完成的.

As far as client-side settings are concerned, usually the client-side installation depends on the type of the driver used. Type 1 drivers actually wrap another database API like ODBC, and hence require the corresponding ODBC driver to setup as well. Type 2 drivers require the DLLs or shared objects to be present in java.library.path, and usually this is done by setting the PATH or LD_LIBRARY_PATH environment variables.

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

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