C3P0 for Connection Pooling

This section provides a quick introduction on C3P0, which is a popular open source JDBC database connection pool library developed by Steve Waldman.

C3P0 is a mature and highly concurrent JDBC Connection pooling library developed by Steve Waldman. It supports caching and reuse of Connections and PreparedStatements. Here is what I did to download C3P0 on my local computer.

1. Go to C3P0 sourceforge.net site at https://sourceforge.net/projects/c3p0/.

2. Click "Files > c3p0-bin > c3p0-0.9.5.5" and download "c3p0-0.9.5.5.bin.zip".

3. Unzip the download file to get the JAR file:

c3p0-0.9.5.5/lib
  501615 Dec 11  2019 c3p0-0.9.5.5.jar
    2723 Dec 11  2019 c3p0-SQL Server-thin-extras-0.9.5.5.jar
  630956 Dec 11  2019 mchange-commons-java-0.2.19.jar

According to the documentation, we have 2 options to create a connection pool with C3P0:

1. Using com.mchange.v2.c3p0.ComboPooledDataSource class, which implements the standard JDBC javax.sql.DataSource interface to manage the connection pool with JavaBean style properties.

2. Using com.mchange.v2.c3p0.DataSources class, which converts a unpooled DataSource to a pooled DataSource using PoolBackedDataSource with default configurations.

To use C3P0 0.9.5.5, for most JDBC operations, you only need c3p0-0.9.5.5.jar file and the JDBC drive JAR file for your specific database server.

Table of Contents

 About This Book

 JDBC (Java Database Connectivity) Introduction

 JDK (Java SE) Installation

 Microsoft SQL Server Express Edition

 Microsoft JDBC Driver for SQL Server

 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

 SQL Server BLOB (Binary Large Object) - BLOB

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

 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

 Archived Tutorials

 References

 Full Version in PDF/EPUB