Reputation: 9
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.
Upvotes: 0
Views: 2333
Reputation: 76709
Why we cannot use JDBC Type 1 (JDBC-ODBC Bridge driver) and type 2 driver for web application development.
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).
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.
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.
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.
Upvotes: 2
Reputation: 308733
The type I JDBC-ODBC bridge driver is not recommended for production applications. It was a Java 1.0 artifact that allowed immediate interconnection via ODBC for development, nothing more.
Type II JDBC drivers require native code in order to work. It uses the client-side native libraries for your particular relational database. You have to be able to point to those libraries using LD_LIBRARY_PATH or some other environment variable.
You want a type IV JDBC driver, which is 100% pure Java with no client installation needed. All you need is a JAR file in your CLASSPATH.
Upvotes: 2