GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  JDBC
Go To First  |  Previous Question  |  Next Question 
 JDBC  |  Question 135 of 137    Print  
What is difference b/w Type-1 and Type-4 JDBC Driver with Example ?
Give me brief description with small Example


  
Total Answers and Comments: 5 Last Update: April 28, 2009     Asked by: timmireddy 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: konnipati.sivaa
 

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



Above answer was rated as good by the following members:
Mr.ignorant, hcse04
July 29, 2008 02:00:25   #1  
saankhya2003 Member Since: July 2008   Contribution: 4    

RE: What is difference b/w Type-1 and Type-4 JDBC Driver with Example ?
In case of typeI driver native database libraries have to be installed in the client this is not a pure java driver. ODBC acts as a bridge.
In case of type4 driver the database calls are converted to the client calls directly without the help of any middle ware hence widely used.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
July 30, 2008 01:01:14   #2  
aleemkh Member Since: July 2008   Contribution: 17    

RE: What is difference b/w Type-1 and Type-4 JDBC Driver with Example ?
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

 
Is this answer useful? Yes | No
July 30, 2008 11:57:50   #3  
konnipati.sivaa Member Since: October 2007   Contribution: 6    

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

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


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
April 24, 2009 03:40:24   #4  
vkrntwadekar Member Since: April 2009   Contribution: 1    

RE: What is difference b/w Type-1 and Type-4 JDBC Driver with Example ?
The Type 1 grammar is used for local database.
While Type 4 grammar is used for the network databases.

 
Is this answer useful? Yes | No
April 25, 2009 21:58:28   #5  
Ravi.Hingarajiya Member Since: February 2009   Contribution: 8    

RE: What is difference b/w Type-1 and Type-4 JDBC Driver with Example ?
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


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape