Download type1 : JDBC (ODBC) Bridge Drivers:

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Oracle Database wikipedia , lookup

Object-relational impedance mismatch wikipedia , lookup

PL/SQL wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Transcript
The JDBC API is based mainly on a set of interfaces, not classes. It’s up to the
manufacturer of the driver to implement the interfaces with their own set of classes. The
above figure is a class diagram that shows the basic JDBC classes and interfaces; these
make up the core API. Notice that the only concrete class is DriverManager. The rest of
the core API is a set of interfaces.
DriverManager is used to load a JDBC Driver. A Driver is a software vendor’s
implementation of the JDBC API. After a driver is loaded, DriverManager is used to get
a Connection. In turn, a Connection is used to create a Statement, or to create and
prepare a PreparedStatement or CallableStatement. Statement and PreparedStatement
objects are used to execute SQL statements. CallableStatement objects are used to
execute stored procedures. A Connection can also be used to get a DatabaseMetaData
object describing a database’s functionality.
The results of executing a SQL statement using a Statement or PreparedStatement are
returned as a ResultSet. A ResultSet can be used to get the actual returned data or a
ResultSetMetaData object that can be queried to identify the types of data returned in the
ResultSet.
type1 : JDBC (ODBC) Bridge Drivers:
This type uses bridge technology to connect a Java Client to a third party API such as
ODBC. Sun's JDBC-ODBC bridge is an example of this driver. These drivers are
implemented using native code.
ex:
"sun.jdbc.odbc.JdbcOdbcDriver"
"jdbc:odbc: dsn"
type2 : Native API (Part Java Drivers):
These drivers wraps a native API with java classes. The OCI driver is an example of
type 2. Because type 2 drivers implemented using local native code, it is expected to
have better performance than a pure java drivers.
ex:
"oracle.jdbc.driver.OracleDriver"
"jdbc:oracle:oci8:@sid"
type3 : JDBC-Net Protocol Drivers (Pure Java Drivers):
These drivers communicate using a network protocol to a middle-tier server. The
middle tier in turn communicates the Database. Oracle doesn't provide a type3 driver.
They do however have a program called "Connection Manager" that, when used in
combination with Oracle's type 4 driver, acts as a type 3 drivers in many respects.
ex:
"ids.sql.IDSDriver"
"jdbc.jds://ids.ip:12/con?dsn= dsn"
type4 : Native Protocol, (Pure Java Driver) :
This type of drivers written early in Java, communicates directly with the Database. No
local native code is required. Oracle's thin driver is an example for this.
"oracle.jdbc.driver.OracleDriver"
"jdbc:oracle:thin:@ip:1521:sid"