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
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.
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.
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.
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.