Java JDBC

July 1,2016

Today i come to know about the JDBC(Java Database Connection)& the connectivity.

Java JDBC

Java JDBC is a java API to connect and execute query with the database. JDBC API uses jdbc drivers to connect with the database.jdbc

 Use of JDBC:

Before JDBC, ODBC API was the database API to connect and execute query with the  database. But, ODBC API uses ODBC driver which is written in C language (i.e.  platform dependent and unsecured). That is why Java has defined its own API (JDBC API) that uses JDBC drivers (written in Java language).

JDBC Driver

JDBC Driver is a software component that enables java application to interact with the database.There are 4 types of JDBC drivers:

  1. JDBC-ODBC bridge driver
  2. Native-API driver (partially java driver)
  3. Network Protocol driver (fully java driver)
  4. Thin driver (fully java driver)

5 Steps to connect to the database in java

There are 5 steps to connect any java application with the database in java using JDBC. They are as follows:

  • Register the driver class
  • Creating connection
  • Creating statement
  • Executing queries
  • Closing connection

Leave a comment