2 Brief Introduction to JDBC, UCP, and Java in the Database

The Oracle Database is a relational database that you can use to store, modify and use data.

The Java Database Connectivity (JDBC) standard is used by Java applications to access and manipulate data in relational databases.

JDBC is an industry-standard application programming interface (API) that lets you access a RDBMS using SQL from Java. Each vendor implements the JDBC Specification with its own extensions.

Maven is a build automation tool which is used to build and manage the Java project.

Universal Connection Pool (UCP) is a cache of database connection objects that promote reuse of the connections, thus improving the performance.

Java in the Database (OJVM) helps group SQL operations with Java data logic and load them into the database for in-place processing.

This chapter introduces you to the JDBC driver, Universal Connection Pool (UCP), Java in the Database (OJVM) and Maven with the Oracle Database.

  • Java Database Connectivity Driver (JDBC)
  • Universal Connection Pool (UCP)
  • Java in the Database (Oracle JVM)
  • Maven

2.1 Java Database Connectivity Driver (JDBC)

JDBC is a database access protocol that enables you to connect to a database and run SQL statements and queries on the database.

JDBC drivers implement and comply with the latest JDBC specifications. Java applications need to have ojdbc8.jar compatible with JDK8 in their classpath.

This guide uses the following JDBC standard:

  • Oracle JDBC Thin Driver

  • Oracle JDBC Packages

Oracle JDBC Thin Driver

Oracle recommends using the JDBC Thin Driver for most requirements. The JDBC Thin Driver will work on any system with a suitable Java Virtual Machine. (JVM). Some other client drivers that Oracle provides are JDBC thin driver, Oracle Call Interface (OCI) driver, server side thin driver, and server side internal driver.

The JDBC Thin Driver is a pure Java, Type IV driver. The JDBC driver version (ojdbc8.jar) includes support for JDK 8.

JDBC Thin Driver communicates with the server using SQL*Net to access the database.

See Also:

Oracle Database JDBC Developer’s Guide

Oracle JDBC Packages

The following core Java class libraries provide the JDBC APIs:

  • java.sql
  • javax.sql

Include the import statements at the beginning of your program to import the classes which your application needs.

Using Maven Central

All supported releases of the Oracle JDBC drivers are available on Maven Central. So, you can consider Maven Central as a distribution center for the Oracle JDBC drivers and companion JAR files.

2.2 Universal Connection Pool

Connection pools help improve performance by reusing connection objects and reducing the number of times that connection objects are created.

Oracle Universal Connection Pool (UCP) is a feature rich Java connection pool that provides connection pool functionalities, along with high availability, scalability and load balancing with the help of tighter integration with Oracle Database configurations.

A Java application or container must have ucp.jar in their classpath, along with the ojdbc8.jar (JDK8), to be able to use UCP.

See Also:

Oracle Universal Connection Pool Developer’s Guide

2.3 Java in the Database (OJVM)

Oracle Database has a Java Virtual Machine (JVM) that resides in the server. It helps Java applications running in the Oracle JVM on the server to access data present on the same system and same process.

Java in the Database is recommended for applications that are data-intensive. JVM has the ability to use the underlying Oracle RDBMS libraries directly, without the use of a network connection between the Java code and SQL data. This helps improve performance and execution. For data access, Oracle Database uses server-side internal driver when Java code runs on the server.