JDBC Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 2.11

Overview of CLOB (Character Large Object)

This section describes what are CLOB (Character Large Object) data types and how to work with them.

CLOB (Character Large Object) is a large collection of character data stored in a database table. Different database servers handles CLOB differently. But there are some common characteristics like:

  • CLOB stores character data, which requires a specific encoding schema. For regular ASCII characters, the database default encoding schema is fine. So you you don't need to worry.
  • CLOB data is usually large. Many database servers offer very high maximum sizes like 4 GB.
  • Operations on CLOB data is usually restricted. For example, LIKE may not be used on CLOB data.
  • CLOB data is usually not directly stored inside the table. It is stored in different storage areas and its reference address is stored inside the table.

JDBC offers an interface, java.sql.Clob, to allow JDBC driver to provide generic functionalities to handle CLOB data in the database.

CLOB data can also be handled as character strings with the java.lang.String class.

CLOB data can also be handled as character streams with the java.io.Reader class.

Table of Contents

 About This Book

 JDBC (Java Database Connectivity) Introduction

 Downloading and Installing JDK - Java SE

 Installing and Running Java DB - Derby

 Derby (Java DB) JDBC Driver

 Derby (Java DB) JDBC DataSource Objects

 Java DB (Derby) - DML Statements

 Java DB (Derby) - ResultSet Objects of Queries

 Java DB (Derby) - PreparedStatement

 MySQL Installation on Windows

 MySQL JDBC Driver (MySQL Connector/J)

 MySQL - PreparedStatement

 MySQL - Reference Implementation of JdbcRowSet

 MySQL - JBDC CallableStatement

 MySQL CLOB (Character Large Object) - TEXT

 MySQL BLOB (Binary Large Object) - BLOB

 Oracle Express Edition Installation on Windows

 Oracle JDBC Drivers

 Oracle - Reference Implementation of JdbcRowSet

 Oracle - PreparedStatement

 Oracle - JBDC CallableStatement

 Oracle CLOB (Character Large Object) - TEXT

 Oracle BLOB (Binary Large Object) - BLOB

 Microsoft SQL Server 2005 Express Edition

 Microsoft JDBC Driver for SQL Server - sqljdbc.jar

 Microsoft JDBC Driver - Query Statements and Result Sets

 Microsoft JDBC Driver - DatabaseMetaData Object

 Microsoft JDBC Driver - DDL Statements

 Microsoft JDBC Driver - DML Statements

 SQL Server - PreparedStatement

SQL Server CLOB (Character Large Object) - TEXT

Overview of CLOB (Character Large Object)

 Create Tables with CLOB Columns

 Inserting CLOB Values with SQL INSERT Statements

 Inserting CLOB Values with setString() Method

 Inserting CLOB Values with setCharacterStream() Method

 Closing InputStream Too Early on setCharacterStream()

 Retrieving CLOB Values with getString() Method

 Retrieving CLOB Values with getCharacterStream() Method

 Retrieving CLOB Values with getClob() Method

 Inserting CLOB Values with setClob() Method

 SQL Server BLOB (Binary Large Object) - BLOB

 JDBC-ODBC Bridge Driver - sun.jdbc.odbc.JdbcOdbcDriver

 JDBC-ODBC Bridge Driver - Flat Text Files

 JDBC-ODBC Bridge Driver - MS Access

 JDBC-ODBC Bridge Driver - MS SQL Server

 Summary of JDBC Drivers and Database Servers

 Additional Tutorial Notes to Be Added

 References

 PDF Printing Version

Dr. Herong Yang, updated in 2007
Overview of CLOB (Character Large Object)