File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Type 2 Vs Type 4 JDBC DRIVER Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Type 2 Vs Type 4 JDBC DRIVER" Watch "Type 2 Vs Type 4 JDBC DRIVER" New topic

Type 2 Vs Type 4 JDBC DRIVER

Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 235

Hi all,
I have a question regarding jdbc drivers.
Why is it that Type 4 is good for internet applications as compared to type 2?The confusion is that in both the case we need to install something in the client machine: in the type 2 driver we install native db libraries in client machine,which makes it database specific,and in type 4 we use the driver corresponding to a database.So in both the cases,drivers are DBMS dependent.
So why is it that type 4 is better than type 2 for internet applications?

Martin Vajsar

Joined: Aug 22, 2010
Posts: 3733

Non-Java drivers are not only database specific, but also platform specific and furthermore, often require a configuration of their own (eg. standard Oracle database client - TNSNAMES.ORA etc.). Whereas Java-only drivers indeed are database specific, but once bundled into your project, do not require further driver installation or configuration.

So unless your application really needs something that only a native driver can provide (eg. some of the few functionalities supported by the type 2 driver only for Oracle), I'd say type 4 driver is always easier to use than type 2 driver, regardless of the character of the application. Though the DB vendor might provide some means to bundle the type 2 driver with the application (I think Oracle does have something like this), you still have the platform dependency, which is often a clear disadvantage and in any case one more thing to learn and maintain.
I agree. Here's the link:
subject: Type 2 Vs Type 4 JDBC DRIVER
It's not a secret anymore!