wood burning stoves 2.0*
The moose likes JDBC and the fly likes Difference between Type II and Type IV driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Difference between Type II and Type IV driver" Watch "Difference between Type II and Type IV driver" New topic
Author

Difference between Type II and Type IV driver

Raj Jindal
Ranch Hand

Joined: Jan 17, 2003
Posts: 50
Can anybody explain me the difference between type 2 and type 4 jdbc driver. It is said that Type 4 driver directly specks to Database. it resides on server. Then wat resides on the client in case of type 4 that helps it to communicate with the DB.
i am looking for a details convincing answer
vikasids sharma
Ranch Hand

Joined: Aug 01, 2003
Posts: 157
Originally posted by raj jindal:
Can anybody explain me the difference between type 2 and type 4 jdbc driver.

Type 2 drivers act as wrapper across client code(native code libraries).basically the call is first delegeted to native code libraries which further interacts with database.
Type 4 drivers are not wrappers rather pure java drivers,call is directly made to destined database.
It is said that Type 4 driver directly specks to Database. it resides on server. Then wat resides on the client in case of type 4 that helps it to communicate with the DB.

The key point in using Type 4 driver is you just make type 4 driver classes available to calling code(through class path or other means)to let your code interact with database.


Thanks
Vikas Sharma
SCJP(1.4)
Raj Jindal
Ranch Hand

Joined: Jan 17, 2003
Posts: 50
can anybody explain me in more detail the difference between type 2 and type 4 jdbc drivers
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

vikasids sharma's explanation was quite good. Type II drivers use native (i.e., non-Java code), whereas type IV drivers are 100% Java. There are very few type II drivers anymore, but they were very common when JDBC first came out.


[Jess in Action][AskingGoodQuestions]
Sainudheen Mydeen
Ranch Hand

Joined: Aug 18, 2003
Posts: 218
Hi Raj
Will this help you?

---------------
Sainudheen
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
But given the fact that the DB (RDBMS) is not implemented in Java, Type IV also uses native code so or so... only the level of abstraction is one level lower.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34


But given the fact that the DB (RDBMS) is not implemented in Java, Type IV also uses native code so or so... only the level of abstraction is one level lower.

If by "native code" we mean only JNI code, then no, this isn't right; most type 4 drivers have no native code; they talk to the database using a database's own network interface.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Type 4 drivers are pure java drivers with no native code but they proprietary protocol.


Groovy
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

www.javaworld.com/javaworld/jw-07-2000/ jw-0707-jdbc.html
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Difference between Type II and Type IV driver
 
Similar Threads
about Jbdc driver
Driver and DriverManager
Oracle type 4 or type 2 driver?
JDBC and JRE
How to know one is using a Type 4 Driver with DB2