JDBC Driver API Version and Features

Previously we learned the Introduction to JDBC, the difference between JDBC and ODBC. All vendor companies created JDBC drivers based on common rules and guidelines of JDBC technology or JDBC API. There are many versions of the JDBC driver API. Here we will discuss the different JDBC API version and their features. What is the latest JDBC driver API version?

The Java Database Connectivity (JDBC) API is the industry standard for database-independent connectivity between the Java programming language and a wide range of databases—SQL databases and other tabular data sources, such as spreadsheets or flat files. The JDBC API provides a call-level API for SQL-based database access.

JDBC technology allows us to use the Java programming language to exploit “Write Once, Run Anywhere” capabilities for applications that require access to enterprise data. With a JDBC technology-enabled driver, we can connect all corporate data even in a heterogeneous environment.

JDBC Driver API

JDBC is a Java-based software technology/specification providing JDBC API having a set of rules and guidelines to develop JDBC driver software by using Java language. Working with JDBC driver software is nothing but working JDBC technology which is not installable but we can arrange JDBC driver software as jar files. The Java class that implements java.sql.Driver(I) directly or indirectly is called JDBC driver class.

The JDBC driver API versions are,

  • JDBC 1.0 API
  • JDBC 1.2 API
  • JDBC 2.0 Optional Package API
  • JDBC 2.1 Core API
  • JDBC 3.0 API
  • JDBC 4.0 API
  • JDBC 4.1 API
  • JDBC 4.2 API
  • JDBC 4.3 API

The JDBC 4.3 is the latest version of JDBC technology.

Table for JDBC version, its JDK implementation, and releases year with JSR Specification

JDBC
Version
JDK
Implementation
YearJSR
Specification
JDBC 1.0 APIJDK 1.01996
JDBC 1.2 APIJDK 1.11997
JDBC 2.0
Optional Package API
JDBC 2.1 Core APIJDK 1.21999
JDBC 3.0 APIJ2SE 1.42001JSR 54
JDBC 4.0 APIJava SE 62006JSR 221
JDBC 4.1 APIJava SE 72011JSR 221
JDBC 4.2 APIJava SE 82014JSR 221
JDBC 4.3 APIJava SE 92017JSR 221

The JDBC technology will not give rules and guidelines as English statements, They will be given as APIs.

  • The interface of the technology API represents only rules (Upto Java7).
  • The abstract classes of the technology API represent both rules and guidelines.
  • The concrete classes of the technology API represent only guidelines.

How interface, abstract class, and concrete class can provide rules and guidelines? Well, whenever we extend a class from an abstract class then all its abstract methods must be implemented (rule) and other methods can be overridden (guidelines). The concrete class has only the concrete methods so it provides guidelines only. Up to Java7, the interface had only a method declaration that provides rules, but from Java8 the interfaces can have method implementation also, therefore it provides both rules and guidelines.

Database and JDBC API Version

The below table lists the Oracle JDBC drivers and the JDBC specification supported in that release.

Oracle Database
Version
YearJDBC Specification
Compliance
11.2 or 11gR2Sep 2009JDBC 3.0 in ojdbc5.jar with JDK5

JDBC 4.0 in ojdbc6.jar with JDK 6, JDK 7, and JDK 8
12.1 or 12cR1Jun 2013JDBC 4.0 in ojdbc6.jar with JDK 6

JDBC 4.1 in ojdbc7.jar with JDK 7, and JDK 8
12.2 or 12cR2Mar 2017JDBC 4.2 in ojdbc8.jar with JDK 8
18.3July 2018JDBC 4.2 in ojdbc8.jar with JDK 8, JDK 9, with JDK10, JDK11
19.3Apr 2019JDBC 4.2 in ojdbc8.jar with JDK8, JDK9, JDK10, JDK11

JDBC 4.3 in ojdbc10.jar with JDK10, JDK11

Table for MySQL database connector and JDBC driver API version.

Connector/J
Version
JDBC API
Version
MySQL Server
Version
Required JDK
5.13.0, 4.0, 4.1, 4.25.6, 5.7, 8.0JDK 5, JDK 8 or higher
8.04.25.6, 5.7, 8.0JDK 8 or higher

Features of JDBC 1.x and 2.x API

No need to remember the features of different versions of JDBC API, just look them once.

Features of JDBC driver 1.0 API version

  • The JDBC 1.0 API was the first officially JDBC API launched consists of the following Java classes and interfaces that we can open connections to particular databases.
  • This version includes a completely redesigned administration console with an enhanced graphical interface to manage and monitor distributed virtual databases.

Features of JDBC driver 1.2 API version

  • It supports Updatable ResultSets.
  • The DatabaseMetaData code has been refactored to provide more transparency with regard to the underlying database engine.
  • New Pass-through schedulers for increased performance.

Features of the JDBC 2.0 Optional Package API

  • The use of DataSource interface for making a connection.
  • Use of JNDI to specify and obtain database connections.
  • It allows us to use Pooled connections. Due to this features we can reuse the connection.
  • In this version the distributed transactions is possible.
  • It provides a way of handling and passing data using Rowset technology.

Features of the JDBC 2.1 core API

  • Scroll forward and backward in a result set or has the ability to move to a specific row.
  • Instead of using SQL commands, we can make updates database tables using methods in the Java programming language.
  • We can use multiple SQL statements in a database as a unit, or batch.
  • It uses the SQL3 datatypes as column values. SQL3 types are Blob, Clob, Array, Structured type. Ref.
  • It increased the support for storing persistent objects in the Java programming language.
  • It supports for the time zones in date, time, and Timestamp values.
  • Full precision for java.math.BigDecimal values.

Features of JDBC driver 3.0 API version

  • Reusability of prepared statements by connection pools.
  • In this version, there is a number of properties defined for the ConnectionPoolDataSource. These properties can be used to describe how the PooledConnection objects created by DataSource objects should be pooled.
  • A new concept has been added to this API of savepoints. One of the useful new features is transactional savepoints. With JDBC 3.0 the transactional model is now more flexible.
  • Retrieval of parameter metadata.
  • It has added a means of retrieving values from columns containing automatically generated values.
  • Added a new data type i.e. java.sql.BOOLEAN
  • Passing parameters to CallableStatement
  • The data in the Blob and Clob can be altered. JDBC 3.0 introduces a standard mechanism for updating BLOB and CLOB data.
  • DatabaseMetaData API has been added.
  • It allows stored procedure parameters to be called by name.

Features of JDBC 4.0 API Version

  • It supports the autoloading of JDBC driver class. In JDBC 4.0 after invoking the getConnection() method on DriverManger, it will automatically load the JDBC driver class. For example, In the case of the Oracle database (with JDK1.8+ version), it will automatically load oracle.jdbc.OracleDriver class.
  • Connection management enhancements. In JDBC it may happen that a Connection is lying idle or not closed in a pool, then it becomes stale over time. This will lead to the connection pool run out of resources due to a stale connection.
  • It supports for RowId data type. JDBC introduces support for ROWID, a data type that had been using in database products even before it became part of the SQL.
  • SQL exception handling enhancements. The JDBC 4.0 addresses the error handling beautifully. As databases are often remotely accessible resources, problems such as network failures are common and it can cause exceptions when executing a database operation. SQL statements can also cause exceptions. Prior to JDBC 4.0, most JDBC operations generated a simple SQLException.
  • DataSet implementation of SQL using Annotations. The JDBC 4.0 specification leverages annotations to allow developers to associate a SQL query with a Java class without a need to write a lot of code to achieve this association.
  • SQL XML support.

How to check JDBC supports auto-loading of driver class on not?
Open jar file of JDBC driver, go to META-INF/services folder, and open the “java.sql.Driver” file with any text editor software. If it contains the driver class name then the JDBC driver supports the auto-loading of the driver class.

DatabaseDriver Class Name
(Latest)
Oracleoracle.jdbc.OracleDriver
MySQLcom.mysql.cj.jdbc.Driver
PostgreSQLorg.postgresql.Driver

Features of JDBC 4.1, 4.2, and 4.3 API Versions

Main new features introduced in JDBC 4.1 API version are,

  • Added support for try-with-resources statements
  • Enhanced Date.valueOf and Timestamp.valueOf
  • Additional Mappings from Java Object to JDBC Types
  • Some JDBC API changes

Main new features introduced in JDBC 4.2 are,

  • Added support for REF CURSOR
  • Some JDBC API changes
  • The following interfaces are added:- java.sql.DriverAction interface, java.sql.SQLType interface, and java.sql.JDBCType Enum

Main new features introduced in JDBC 4.3 are,

  • Added support for Sharding
  • The following interface are added:- java.sql.ConnectionBuilder interface, java.sql.ShardigKey interface, java.sql.ShardingKeyBuilder interface, javax.sql.XAConnectionBuilder interface, javax.sql.PooledConnectionBuilder interface

If you enjoyed this post, share it with your friends. Do you want to share more information about the topic discussed above or do you find anything incorrect? Let us know in the comments. Thank you!

References:-

Also Learn,

Leave a Comment

Your email address will not be published. Required fields are marked *