Two Laptop Bag
The moose likes JDBC and Relational Databases and the fly likes JDBC driver types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC driver types" Watch "JDBC driver types" New topic

JDBC driver types

anagha patankar
Ranch Hand

Joined: Dec 26, 2005
Posts: 53
Hello ,
I have googled around for the different types of drivers ( 1 ... 4 )

While reading a number of articles I was not quite sure of the following :

1 >
Type 2 Drivers need vendor database library to be loaded on each client machine

I am not sure what this means - client here would probably mean the appserver or servlet engine ( Tomcat / weblogic / websphere ) etc

So I dont see or understand the problem
If I were to use a Type 4 driver - I would still need to set it in the classpath

So again - is the above disadvantage for type 2 driver really a disadvantage ?
( I am not talking about performance here )

2 >
Not quite sure where a Type 3 driver fits in the real world
Are there any real world scenarios where such a driver is used ?
( Pardonez my ignorance )

3 >
Not sure why I would use a Type 2 driver as compared to a type 4 driver
when type 4 would give better performance as compared to type 2

Thanks in advance ,
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32635

1) "Native" refers to binary. For type 3 and 4 drivers you can distribute a jar with .class files that can be run on any OS that supports Java. For type 1 and 2 drivers, you must get actual executable code for the OS you are using.

2) When type 4 drivers were introduced, not all vendors provided them. So people used type 3 instead. If you have both type 3 and 4 available, there isn't a scenario that I can think of to use type 2.

3) Type 2 drivers can be optimized for a specific OS/platform. This makes them faster. In practice, the database call itself takes even longer and the time difference doesn't have a noticeable effect on the system.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
anagha patankar
Ranch Hand

Joined: Dec 26, 2005
Posts: 53
Thanks Jeanne for your inputs

Regards ,
I agree. Here's the link:
subject: JDBC driver types
It's not a secret anymore!