Home >>Java JDBC Tutorial

Java JDBC Tutorial

Java JDBC Tutorial

JDBC in the Java language basically elaborates to the Java Database Connectivity that is known for being a standard Java API, mainly for the database-independent connectivity between the Java programming language and a wide array of databases.

Java JDBC API is basically an API that possesses the ability to access any kind of tabular data, especially the data that has been stored in a Relational Database. JDBC is known to works with Java on a variety of platforms, like Mac OS, Windows, and the various versions of UNIX.

Java JDBC is an important part of JavaSE (Java Standard Edition). JDBC API makes the use of the JDBC drivers in order to connect with the database. There are basically four types of JDBC drivers in the Java language:

  • JDBC-ODBC Bridge Driver,
  • Native Driver,
  • Network Protocol Driver, and
  • Thin Driver

The JDBC library is most commonly known for including the APIs for each of the tasks that has been depicted below and these are the tasks that are commonly associated with the use of database:

  • Connecting to a database.
  • Making SQL or MySQL statements.
  • Evaluating SQL or MySQL queries in the database.
  • Editing, Viewing & Modifying of the resulting records.

This Java JDBC Tutorial is designed to deliver maximum efficiency and the all the fact about the topic are included in this tutorial along with the JDBC Program In Java.

If you are a beginner and enthusiasts about the technology then it is recommended to stick to this JDBC Tutorial.

Currently JDBC is 4.3 is the latest version. This version has been the stable release since 21st September, 2017. This is basically based on the X/Open SQL Call Level Interface. The java.sql package consists of classes and interfaces for JDBC API.

Here is a list of the popular interfaces of JDBC API that is depicted below:

  • Driver interface
  • Connection interface
  • Statement interface
  • PreparedStatement interface
  • CallableStatement interface
  • ResultSet interface
  • ResultSetMetaData interface
  • DatabaseMetaData interface
  • RowSet interface

Here is a list of popular classes of JDBC API that mostly used in the Java language are depicted below:

  • DriverManager class
  • Blob class
  • Clob class
  • Types class

What is API

API basically elaborates to Application programming interface that is a document containing a description of all the features of a product or software. This generally represents the classes and interfaces that software programs can use in order to communicate with each other. Creation of an API can be done for applications, libraries, operating systems, etc.

Applications of JDBC

Technically, JDBC in the Java language is a specification that delivers a complete set of the interfaces that permits for the portable access to an underlying database. Java is basically used in order to write various types of executables that are depicted below:

  • Enterprise JavaBeans (EJBs).
  • Java Applets
  • Java Applications
  • Java Servlets
  • Java ServerPages (JSPs)

All of the above mentioned various different executables have the ability to use a JDBC driver in order to access a database and take the advantage of the stored data.

JDBC basically delivers the same capabilities as ODBC that generally leads to allowing Java programs to contain the database-independent code.

The JDBC 4.0 Packages

The java.sql and javax.sql are known as the primary packages that are used for JDBC 4.0. Please note that at the time of writing this very tutorial, this version is known as the latest one. This version basically offers the main classes just for interacting with the user’s data sources.

The new features that are available in these packages also include the changes in the following depicted fields:

  • Connection and statement interface enhancements.
  • Automatic database driver loading.
  • Exception handling improvements.
  • SQL ROWID access.
  • Annotations.
  • Enhanced BLOB/CLOB functionality.
  • National character set support.
  • SQL 2003 XML data type support.

Audience

This Java JDBC tutorial has been designed for the Java programmers who have an interest in understanding the JDBC framework in detail along with all the facts and usage and of course its architecture.

Prerequisites

It is recommended that before proceeding with this tutorial, the reader should have check themselves for having a good understanding of Java programming language. This is because here the readers are going to deal with RDBMS; and the user should have prior exposure to SQL and Database concepts.


Java JDBC Tutorial Index

Sr.No. Topics
1 JDBC Driver
2 JDBC Database Connections
3 JDBC SQL Syntax
4 Java Database Connectivity with Oracle
5 Java Database Connectivity with MySQL

Learn Latest Tutorials