JDBC for Oracle - Herong's Tutorial Examples

https://www.herongyang.com/JDBC-Oracle

© 2003-2024 Herong Yang. All rights reserved.

JDBC Tutorials This JDBC tutorial book is a collection of notes and sample codes written by the author while he was learning JDBC technology himself. Topics include installing JDK and Oracle server; using Oracle JDBC driver; database connection URLs; introduction to Result Set, Meta Data, Prepared Statement, CLOB, and BLOB. Updated in 2024 (Version v3.13) with minor changes.

Table of Contents

About This Book

JDBC (Java Database Connectivity) Introduction

What Is JDBC?

JDBC Version and History

JDBC Driver Types

Establishing Connections from JDBC to Databases

DriverManager - Loading JDBC Driver

DriverManager - Connection URL

JDK (Java SE) Installation

Downloading and Installing JDK

Adding JDK "bin" Directory to Path Setting

Downloading and Installing JDK on Mac

Downloading and Installing JDK on Linux

Compile and Run Java Programs

-cp or -classpath Syntax on Different Systems

JDK Documentation Installation

Oracle Express Edition Installation on Windows

Oracle Database Express Edition (XE) Installation

Accessing Oracle Server through Web Interface

Creating Oracle Database Users

SQL*Plus - Oracle Command Line Interface

SQL*Plus - Create New User and Login

Oracle JDBC Drivers

Oracle JDBC Drivers Overview

JDBC Thin Client-Side Driver Installation

Loading JDBC Driver Class - ojdbc16.jar

JDBC Driver Connection URL

Creating Connections with DataSource Class

DataSource Error - makeURL() Failed

Getting Driver and Server Information

"CREATE TABLE" - Creating New Tables

"INSERT INTO" - Inserting New Data Rows

Oracle - Reference Implementation of JdbcRowSet

Overview of RowSet Objects

Installation of JdbcRowSet Reference Implementation

Connecting JdbcRowSet to Database Servers

Connecting JdbcRowSet with a Connection URL

Connecting JdbcRowSet with a Predefined Connection Object

Connecting JdbcRowSet with a Predefined ResultSet Object

Connecting JdbcRowSet with JNDI Directory Service

JdbcRowSet Query Statement with Parameters

Inserting Rows with JdbcRowSet Objects

Oracle - PreparedStatement

PreparedStatement Overview

PreparedStatement with Parameters

PreparedStatement in Batch Mode

Performance of Inserting Rows with a PreparedStatement

Performance of Inserting Rows with a Regular Statement

Performance of Inserting Rows with a ResultSet

Oracle - JBDC CallableStatement

Overview of CallableStatement Objects

"CREATE PROCEDURE" - Creating a Simple Procedure

Creating Procedures with IN and OUT Parameters

Creating CallableStatement Objects with prepareCall()

Creating CallableStatement Objects with Parameters

getProcedures() - Listing Stored Procedures

Oracle CLOB (Character Large Object) - TEXT

Oracle BLOB (Binary Large Object) - BLOB

Overview of BLOB (Binary Large Object)

Create Tables with CLOB Columns

Inserting BLOB Values with SQL INSERT Statements

Inserting BLOB Values with setBytes() Method

Inserting BLOB Values with setBinaryStream() Method

Closing InputStream Too Early on setBinaryStream()

Retrieving BLOB Values with getBytes() Method

Retrieving BLOB Values with getBinaryStream() Method

Retrieving BLOB Values with getBlob() Method

Inserting BLOB Values with setBlob() Method

Copying BLOB Values to New Rows

Using Connection Pool with JDBC

What Is Database Connection Pool

Commons DBCP for Connection Pooling

Connection Pooling with Commons DBCP BasicDataSource

Connection Pooling with Commons DBCP PoolingDriver

C3P0 for Connection Pooling

Connection Pooling with C3P0 ComboPooledDataSource

Connection Pooling with C3P0 DataSources

Archived Tutorials

Archived: Downloading and Installing JDK 13 on Mac

Archived: Downloading and Installing JDK 12 on Windows

Archived: Java SE 8 Installation

Archived: Java SE 1.6 Update 2 Installation

Archived: JDK 1.6 Documentation Installation

Archived: Oracle Database Express Edition (XE) Installation

Archived: Accessing Oracle Server through Web Interface

Archived: Creating Oracle Database Users

Archived: SQL*Plus - Oracle Command Line Interface

Archived: JDBC Thin Client-Side Driver Installation

References

Full Version in PDF/EPUB

Keywords: JDBC, Java, Database, Tutorial, Example, Book