JDBC Tutorial

JDBC Introduction

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 doesnot support JDBC-ODBC Bridge Driver
SQL-99 Data Types
  • A Blob instance maps an SQL BLOB value.
  • A Clob instance maps an SQL CLOB value.
  • An Array instance maps an SQL ARRAY value.
  • A Struct instance maps an SQL structured type value.
  • A Ref instance maps an SQL REF value.