Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

Copyright © 2006 Sun Microsystems, Inc. All rights reserved.

JDBC for CDC/FP Optional Package

Package javax.sql

Provides the API for data source access and manipulation of tabular data as JavaBeans.

This package was originally developed as a supplement to java.sql package and, as of the version 1.4 release, is included in the JavaTM 2 SDK, Standard Edition.

See:
          Description

Interface Summary
DataSource A factory for connections to the physical data source that this DataSource object represents.
RowSet The interface that adds support to the JDBC API for the JavaBeansTM component model.
RowSetInternal The interface that a RowSet object implements in order to present itself to a RowSetReader or RowSetWriter object.
RowSetListener An interface that must be implemented by a component that wants to be notified when a significant event happens in the life of a RowSet object.
RowSetMetaData An object that contains information about the columns in a RowSet object.
RowSetReader The facility that a disconnected RowSet object calls on to populate itself with rows of data.
RowSetWriter An object that implements the RowSetWriter interface, called a writer.
 

Class Summary
RowSetEvent An Event object generated when an event occurs to a RowSet object.
 

Package javax.sql Description

Provides the API for data source access and manipulation of tabular data as JavaBeans.

This package was originally developed as a supplement to java.sql package and, as of the version 1.4 release, is included in the JavaTM 2 SDK, Standard Edition. It remains an essential part of the Java 2 SDK, Enterprise Edition (J2EETM).

The javax.sql package in the JDBC for CDC/FP Optional Package provides for the following:

  1. The DataSource interface as an alternative to the DriverManager for establishing a connection with a data source
  2. Rowsets

Applications use the DataSource and RowSet APIs directly.

Using a DataSource Object to Make a Connection

The javax.sql package provides the preferred way to make a connection with a data source. The DriverManager class, the original mechanism, is still valid, and code using it will continue to run. However, the newer DataSource mechanism is preferred because it offers many advantages over the DriverManager mechanism.

These are the main advantages of using a DataSource object to make a connection in the CDC environment:

.Driver vendors provide DataSource implementations. A particular DataSource object represents a particular physical data source, and each connection the DataSource object creates is a connection to that physical data source.

It is possible to use a DataSource object directly to create a connection. An application can create an instance of a DataSource, set the neccessary properties and create a Connection object. The following code fragment demonstrates:

// create an instance of the vendors data source
DataSource ds = new VendorDataSource();

// now set the properties
ds.setServerName("dbServer.acct");
ds.setPortNumber(1234);

// get a connection
Connection conn = ds.getConnection(user, pass);

The properties that are needed to connect using a particular DataSource will depend on the implementation. The JDBC 3.0 API Specification lists the properties that every driver must support. (see Package Specification below)

Rowsets

The RowSet interface works with various other classes and interfaces behind the scenes. These can be grouped into three categories.
  1. Event Notification

  2. Metadata
  3. The Reader/Writer Facility
    A RowSet object that implements the RowSetInternal interface can call on the RowSetReader object associated with it to populate itself with data. It can also call on the RowSetWriter object associated with it to write any changes to its rows back to the data source from which it originally got the rows. A rowset that remains connected to its data source does not need to use a reader and writer because it can simply operate on the data source directly.

The RowSet interface may be implemented in any number of ways, and anyone may write an implementation. Developers are encouraged to use their imaginations in coming up with new ways to use rowsets.

Package Specification

Related Documentation

The Java Series book published by Addison-Wesley Longman provides detailed information about the classes and interfaces in the javax.sql package:

Related specifications

The JDBC RowSet Implementations - JSR-114 is seeking to standardize the RowSet Implementations for use with all JDBC APIs.


JDBC for CDC/FP Optional Package

Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 169 specification.