sampleqa.in tutorials, excel 365 tutorial

JDBC Tutorial


JDBC abbrevated as Java Database Connectivity.It can connect to any relational databases, such as Oracle,MySQL,Sybase etc., In-memory relational databases such as derby etc., Most of the relational databases implemented using C/C++ languages , and runs in different address spaces. In order to communicate with any database client must have a JDBC Driver. This driver is proprietery from specific vendor, and also freely downloadable. JDBC Driver converts JDBC API calls to database calls.Drivers are available from specific vendor sites.

JDBC API is part of Java SE framework, it acts as an abstract to connect to any database. It has set of classes and interfaces.Actual implementation of JDBC API done at Driver software(.jar) side. These drivers are different from each vendor. and also version specific.

Where as In-memory databases like derby has built-in JDBC driver,and implemeted it as a pure java JDBC driver

Types of JDBC Drivers

  • Type-1 Driver JDBC-ODBC Bridge Driver
  • Type-2 Driver This driver is partly java and Partly native code driver.
  • Type-3 Driver This is pure java driver that uses middleware driver to connect to database.
  • Type-4 Driver Pure Java JDBC Driver and is directly connect to database.
Java 8 version does not support JDBC-ODBC Bridge Driver

Type 1 JDBC Driver

     JDBC Type 1 Driver is a JDBC-ODBC bridge. JDBC Calls converted to ODBC calls. ODBC must be installed

Type 2 JDBC Driver

    For Oracle Type 2 Driver is OCI call driver. Oracle Call Interface Driver. Its a Client side driver. JDBC OCI driver uses the standard Java Native Interface(JNI) to call OCI C libraries. JDBC OCI driver can be used with Microsoft and IBM JVMs. if your application is going to commuincate over non-TCP/IP network, then JDBC OCI driver is preferred choice.

Type 3 JDBC Driver

     JDBC Type 3 Driver, It is a network driver, It should be configured in application servers,has own protocol to communicate with DBMS.

Type 4 JDBC Driver

     JDBC Type 4 Driver, implemented using Java. Directly talks to Database. Performance wise much better compared to earlier JDBC Drivers. It has the advantage of being platform-independent

JDBC Architecture

JDBC Features

      JDBC features differs based on type of drivers you use and also version of the Driver. Higher version of the Driver has rich feature support.

JDBC 3.0 Features

  • SavePoint support
  • PreparedStatement reuse in Connection Pooling
  • Parameter metadata
  • auto-generated keys
  • Multiple ResultSet Objects
  • Holdable Cursor Support
  • BOOLEAN and DATALINK data types
  • Ability to update BLOB and CLOB types