).
Package javax.sql
Provides the API for server side data source access and processing from the JavaTM programming language.See:
Interface Summary
ConnectionEventListener An object that registers to be notified of events generated by a PooledConnection object. ConnectionPoolDataSource A factory for PooledConnection objects. DataSource A factory for connections to the physical data source that this DataSource object represents. PooledConnection An object that provides hooks for connection pool management. 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. XAConnection An object that provides support for distributed transactions. XADataSource A factory for XAConnection objects that is used internally.
Class Summary
ConnectionEvent An Event object that provides information about the source of a connection-related event. RowSetEvent An Event object generated when an event occurs to a RowSet object.
Package javax.sql Description
Provides the API for server side data source access and processing from the JavaTM programming language. This package supplements the 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 provides for the following:
Applications use the DataSource and RowSet APIs directly, but the connection pooling and distributed transaction APIs are used internally by the middle-tier infrastructure.
These are the main advantages of using a DataSource object to make a connection:
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.
A logical name for the data source is registered with a naming service that uses the Java Naming and Directory InterfaceTM (JNDI) API, usually by a system administrator or someone performing the duties of a system administrator. An application can retrieve the DataSource object it wants by doing a lookup on the logical name that has been registered for it. The application can then use the DataSource object to create a connection to the physical data source it represents.
A DataSource object can be implemented to work with the middle tier infrastructure so that the connections it produces will be pooled for reuse. An application that uses such a DataSource implementation will automatically get a connection that participates in connection pooling. A DataSource object can also be implemented to work with the middle tier infrastructure so that the connections it produces can be used for distributed transactions without any special coding.
Connection pooling is totally transparent. It is done automatically in the middle tier of a J2EE configuration, so from an application's viewpoint, no change in code is required. An application simply uses the DataSource.getConnection method to get the pooled connection and uses it the same way it uses any Connection object.
The classes and interfaces used for connection pooling are:
The classes and interfaces used for distributed transactions are:
The XAConnection interface is derived from the PooledConnection interface, so what applies to a pooled connection also applies to a connection that is part of a distributed transaction. A transaction manager in the middle tier handles everything transparently. The only change in application code is that an application cannot do anything that would interfere with the transaction manager's handling of the transaction. Specifically, an application cannot call the methods Connection.commit or Connection.rollback, and it cannot set the connection to be in auto-commit mode (that is, it cannot call Connection.setAutoCommit(true)).
An application does not need to do anything special to participate in a distributed transaction. It simply creates connections to the data sources it wants to use via the DataSource.getConnection method, just as it normally does. The transaction manager manages the transaction behind the scenes. The XADataSource interface creates XAConnection objects, and each XAConnection object creates an XAResource object that the transaction manager uses to manage the connection.
When the RowSet object changes one of its rows, changes all of it rows, or moves its cursor, it also notifies each listener that is registered with it. The listener reacts by carrying out its implementation of the notification method called on it.
The RowSetMetaData interface provides methods for setting the information about columns, but an application would not normally use these methods. When an application calls the RowSet method execute, the RowSet object will contain a new set of rows, and its RowSetMetaData object will have been internally updated to contain information about the new columns.
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.
IMPORTANT NOTE: Code that uses API marked "Since 1.4" must be run using a JDBC technology driver that implements the JDBC 3.0 API. You must check your driver documentation to be sure that it implements the particular features you want to use.