What is difference b/w Type-1 and Type-4 JDBC Driver with Example ?

Give me brief description with small Example

Questions by timmireddy   answers by timmireddy

Showing Answers 1 - 21 of 21 Answers

aleemkh

  • Jul 30th, 2008
 

Type 1 JDBC drivers are  comparatively slow.  They are not pure java drivers. The JDBC calls are converted to ODBC calls . So they are also called as JDBC-ODBC biridge drivers. The the ODBC interacts with database. The other biggest disadvantage is the client or the server should have ODBC installed in it so they are not pure java drivers. The performance is also very slow


Type 4 JDBC drivers are pure java drivers and they are the fastest drivers available.
They dont require ODBC , the JDBC directly interacts with database which makes the process fast. The only disadavantage with TYPE-4 JDBC drivers is that they are speicific to the database . Oracle thin Driver is TYPE-4 JDBC driver which is speicific to only ORACLE database. But this is not an issue as Database provides their own drivers

  Was this answer useful?  Yes

JDBC is a specification, it acts as a vehicle for exchanging SQL statements
between Java application and the database. JDBC API follows two packages
1. java.sql (JDBC Core API)
2. javax.sql (JDBC Ext API)


There are four types of drivers
1. JDBC-ODBC BridgeDriver
2. Native-API partly Java Driver
3. JDBC-Net-protocol Java Driver
4. Native-protocol Java Driver


Type 3,4 are pure Java drivers
Type 1 is common drivers
Type 1,3 data independent drivers
Type 2,4 are data base dependent


Type 1 : Driver is does not connect normal database its only connect RDBMS
system only


java application--->Bridge Driver-------->any database


Drawbacks:
1. We are try to connect our database its not connect java program to database
2. JDBC is normal program (non pointer). our ODBC is implemented pointer
concept. that is why internal conversion means pointer to non pointer takes
place
3. Its very slow compare to all
4. We need to install client libraries from db system into client system


JDBC driver class Name: sun.Jdbc.Odbc.JdbcOdbc Driver
Jdbc URL: Jdbc:Odbc:


Type 4: is Native - Protocol it is pure java Driver


javaApplication---->type4 Driver-------->single DataBase


This driver will use the database prorocol in order to connect database
directly driver does not connect any connection in middle .so it is Fast
compared to all It is two tier Architecture


Type 4 driver class Name: Oracle.Jdbc.driver.OracleDriver
Type4 Driver URL: Jdbc:Oracle:thin:@localhost:number:


From
konnipati.sivakumar

Type 1 JDBC-ODBC Bridge.
Translate JDBC call into ODBC call and sends them to ODBC Driver.
Pros
- All most ODBC Drivers are already available.
Cons - Performance Degrade

Type 4 A native-protocol fully Java technology.
Native-protocol converts JDBC call into vendor specific DBMC.
Pros
- Performance is good and don't need install any software in Client side
Cons
- Users need a different drivers for each driver

  Was this answer useful?  Yes

dasavtar

  • Jan 25th, 2011
 

Type1: JDBC-ODBC Bridge driver
This is a "birdge" driver, Translates all JDBC calls into ODBC calls and sends them to ODBC driver and ODBC inturn will communicate with a database. The Java Native Interface (JNI) is used to call ODBC functions from the JDBC driver.

Type 2: Native-API/partly Java driver
This driver uses native API, converts JDBC calls into database-specific calls i.e. this driver is specific to a particular database.
Example: Oracle will have oracle native api.

Type 3: Net-protocol/All Java driver
This driver use a networking protocol and middleware to communicate with a server.
Database requests are passed through the network to the middle-tier server. The middle-tier then translates the request to the database-specific calls.

Type 4: Native-protocol/all-Java driver
These drivers are written entirely in Java, uses networking libraries to communicate directly with the database server.

  Was this answer useful?  Yes

Suman Kumar Thati

  • Oct 5th, 2012
 

JDBC-ODBC Bridge is a type 1 JDBC driver which converts JDBC operations in to C language ODBC API’s and then ODBC calls are then passed to appropriate ODBC driver.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions