JDBC Tutorials - Herong's Tutorial Examples - Version 2.21, by Dr. Herong Yang

Implementations of the DataSource Interface

This section provides a summary of implementations of the DataSource interface by different JDBC drivers.

JDBC is recommending that the DataSource interface should be used to create database connection objects instead of using the DriverManager class. Many JDBC have provided implementations of the DataSource interfaces. A quick summary of various implementations of the DataSource interface is provided here as a comparison and a reference:

Driver Name: Apache Derby Network Client JDBC Driver
------------
Driver JAR File: derbyclient.jar
DataSource Class: org.apache.derby.jdbc.ClientDataSource
DataSource Example:
  ClientDataSource ds 
    = new org.apache.derby.jdbc.ClientDataSource();
  ds.setServerName("localhost");
  ds.setPortNumber(1527);
  ds.setDatabaseName("TestDB");
  Connection con = ds.getConnection();

Driver Name: JDBC-ODBC Bridge
------------
Driver JAR File: None (included in Java SE 1.6)
DataSource Class: sun.jdbc.odbc.ee.DataSource
DataSource Example:
      sun.jdbc.odbc.ee.DataSource ds 
        = new sun.jdbc.odbc.ee.DataSource();
      ds.setDatabaseName("HY_ACCESS");

Driver Name: MySQL Connctor/J 
------------
Driver JAR File: mysql-connector-java-5.0.7-bin.jar
DataSource Class: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
DataSource Example:
  com.mysql.jdbc.jdbc2.optional.MysqlDataSource ds 
    = new com.mysql.jdbc.jdbc2.optional.MysqlDataSource();
  ds.setServerName("localhost");
  ds.setPortNumber(3306);
  ds.setDatabaseName("HerongDB");
  ds.setUser("Herong");
  ds.setPassword("TopSecret");
  Connection con = ds.getConnection();

Driver Name: Oracle JDBC Thin client-side driver
------------
Driver JAR File: ojdbc14.jar
DataSource Class: oracle.jdbc.pool.OracleDataSource
DataSource Example:
  oracle.jdbc.pool.OracleDataSource ds 
    = new oracle.jdbc.pool.OracleDataSource();
  ds.setDriverType("thin");
  ds.setServerName("localhost");
  ds.setPortNumber(1521);
  ds.setDatabaseName("XE"); // Oracle SID
  ds.setUser("Herong");
  ds.setPassword("TopSecret");
  Connection con = ds.getConnection();

Driver Name: Miscrosoft JDBC Driver
------------
Driver JAR File: sqljdbc.jar
DataSource Class: com.microsoft.sqlserver.jdbc.SQLServerDataSource
DataSource Example:
  com.microsoft.sqlserver.jdbc.SQLServerDataSource  ds 
    = new com.microsoft.sqlserver.jdbc.SQLServerDataSource();
  ds.setServerName("localhost");
  ds.setPortNumber(1269);
  ds.setDatabaseName("AdventureWorksLT");
  ds.setUser("sa");
  Connection con = ds.getConnection();

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

 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

 JDBC Drivers Tested with Java SE 1.6

 Connection URL Formats and Examples

Implementations of the DataSource Interface

 Performances on Inserting Rows

 Additional Tutorial Notes to Be Added

 References

 PDF Printing Version

Implementations of the DataSource Interface - Updated in 2014, by Dr. Herong Yang