Sun Implementation of JdbcRowSet API

This section provides a tutotial example on how to access the reference implementatoin of JdbcRowSet API provided by Sun Microsystems.

The reference implementation of JdbcRowSet API was provided by Sun Microsystems. If you are using JDK 1.6, you need to download and install the Sun implementation JAR file. But since JDK 1.7, the Sun implementation is included in the JDK package now as the default implementation.

To access the Sun implementation, you can use methods from the RowSetProvider class and the RowSetFactory class:

// Creating an instance of the default RowSetFactory implementation
   RowSetFactory f = RowSetProvider.newFactory();

// Creating an instance of JdbcRowSet from the factory
   JdbcRowSet s = f.createJdbcRowSet();

Here is a tutorial program that shows how to create a JdbcRowSet object with the Sun default implementation:

/* MySqlRowSetFactory.java
 * Copyright (c) HerongYang.com. All Rights Reserved.
 */
import java.sql.*;;
import javax.sql.rowset.RowSetProvider;
import javax.sql.rowset.RowSetFactory;
import javax.sql.rowset.JdbcRowSet;
public class MySqlRowSetFactory {
  public static void main(String [] args) {
    try {
      RowSetFactory f = RowSetProvider.newFactory();
      JdbcRowSet s = f.createJdbcRowSet();
      System.out.println("RowSetFactory: "+f.getClass().getName());
      System.out.println("JdbcRowSet: "+s.getClass().getName());
    } catch (Exception e) {
      System.err.println("Exception: "+e.getMessage());
    }
  }
}

Compile and run it with JDK 13, you will get the following output:

herong> javac MySqlRowSetFactory.java

herong> java MySqlRowSetFactory
RowSetFactory: com.sun.rowset.RowSetFactoryImpl
JdbcRowSet: com.sun.rowset.JdbcRowSetImpl

The output confirms that Sun implementation of JdbcRowSet API is the default implementation.

Table of Contents

 About This Book

 JDBC (Java Database Connectivity) Introduction

 JDK (Java SE) Installation

 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

 Overview of RowSet Objects

 Connecting JdbcRowSet to Database Servers

Sun Implementation of JdbcRowSet API

 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

 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 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

 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

 Using Connection Pool with JDBC

 Archived Tutorials

 References

 Full Version in PDF/EPUB