Friday 16 July 2010

JDBC TYPE -2 Driver

What is JDBC Type-2 Driver?
Ans: Type 2 Driver is a JDBC Driver that converts JDBC API calls to DB Driver Native API Calls.
Architecture:

Fig: Type2Driver1.jpg
This 2 tier architecture, because we have API calls is considered as layer but not tier. Here server is a tier because it is not part of the client.
Server means which gives the service. Here Database server is giving service like we are storing the data, and retrieving the data.
Advantages:
·         Is fast compares to the other type of drivers.
Disadvantages:
·         It is database dependent (however this is not a big problem in most of the cases)
·         This driver is partly implemented in java and partly in Native, thus  this driver is unsafe to use unless we are sure that the native implementation is bug free. As any bug in the native code could crash the JVM.
·         The Native libraries (i.e: the database client software) is need to be installed in t client machine.
When to use this type-2 Driver?
Ans:
Is preferred  to use in case if the database is accessed from the server side (Middleware server) application such as a web application as show n in the below architecture:
CASE 1:


Fig: Type2Driver2.JPG
CASE 2:
In this example for suppose in a super market there are several billing machines are available, in each machine standalone software should be installed and all the data should be stored in the Database server, for this purpose Type 2 driver is not recommended.

Fig: Type2Driver3.JPG
This type of drivers are named as part java, part native drivers.
Example:
The JDBC  OCI is a Type 2 driver from Oracle Corporation for accessing the oracle database server.
This JDBC Driver works with the OCI (Oracle Call Interface) Native Driver.
The weblogicOCI is a Type-2 driver from BEA system (now this company is merged into Oracle Corp) for accessing the Oracle DB server.
This driver also works with the OCI native Driver.
(For example you are a MCA Students (for example WEBLOGICOCI), and each of student have a unique name or rollnumber( this type -2 driver).   



No comments:

Post a Comment