Create Tables with CLOB Columns

This section describes how to create tables with CLOB (LONGTEXT) columns in MySQL server.

MySQL server support CLOB with 4 data types:

In order to test CLOB columns in MySQL server, I used the MySQL command line interface to create a test table with one CLOB column:

herong> mysql -u Herong -pTopSecret

mysql> use HerongDB;
Database changed

mysql> CREATE TABLE Article (ID INTEGER PRIMARY KEY AUTO_INCREMENT,
    ->   Subject VARCHAR(256) NOT NULL,
    ->   Body LONGTEXT);
Query OK, 0 rows affected (0.38 sec)

Table of Contents

 About This Book

 JDBC (Java Database Connectivity) Introduction

 JDK (Java SE) Installation

 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

 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

 Retrieving CLOB Values with getString() Method

 Retrieving CLOB Values with getCharacterStream() Method

 Retrieving CLOB Values with getClob() Method

 Inserting CLOB Values with setClob() Method

 MySQL BLOB (Binary Large Object) - BLOB

 Using Connection Pool with JDBC

 Archived Tutorials

 References

 Full Version in PDF/EPUB