JDBC (java database connectivity)
===============================
1. What is JDBC ? what are its advantages ?
A. It is an API .The latest version of jdbc api is (3.0).
The JDBC 3.0 API is divided into two packages:
(1) java.sql and (2) javax.sql.
Both packages are included in the J2SE and J2EE platforms.
advantages:
---------------
The JDBC API can be used to interact with multiple data sources in a distributed, heterogeneous environment.
It can connect to any of the database from java language.
It can switch over to any backend database without changing java code or by minute changes.
2. How many JDBC Drivers are there ? what are they?
A. There are 4 types of JDBC drivers.
a. JDBC-ODBC Bridge Driver(Type-1 driver)
b. Native API Partly Java Driver(Type-2 driver)
c. Net protocol pure Java Driver(Type-3 driver)
d. Native protocol Pure Java Driver(Type-4 driver)
3. Explain about JDBC-ODBC driver(Type-1) ? When this type of driver is used ?
A. In this mechanism the flow of execution will be
Java code(JDBC API)<------>JDBC-ODBC bridge driver<------->ODBC API<------- >ODBC Layer<-------->DataBase
This type of JDBC Drivers provides a bridge between JDBC API and ODBC API.
This Bridge(JDBC-ODBC bridge)translates standard JDBC calls to Corresponding
ODBC Calls, and send them to ODBC database via ODBC Libraries.
The JDBC API is based on ODBC API.
ODBC(Open Database Connectivity)is Microsoft's API for Database drivers.
ODBC is based on X/Open Call Level Interface(CLI)specification for database
access.
The URL and class to be loaded for this type of driver are
Class :- sun.jdbc.odbc.JdbcOdbcDriver
URL :- jdbc:odbc:dsnname
4. Explain about Type-2 driver ? When this type of driver is used ?