JDBC predates the JavaBeans API. One place where JDBC could have made use of JavaBeans is in the ResultSet interface. Specifically, it would have been nice for simple two-tier applications to be able to map GUI widgets directly to a JavaBean representing data from the database. The JDBC Optional Package merges JavaBeans with result set management in a generalized fashion that is not limited to simple two-tier systems. This merger comes in the form of rowsets.


In case you are not familiar with JavaBeans, it is Java’s client-side component model. By writing your client-side components to the JavaBeans specification, you make it possible for them to plug into diverse applications. The specification dictates an event model for UI events and naming conventions for your components. JavaBeans, for example, enables you to write a component such as a RowSet and have other objects that know nothing about rowsets or the concept of a RowSet listen to that RowSet component for changes.

The rowset specification, like the connection pooling specification, is not necessarily provided by your JDBC driver. Instead, third parties can implement the rowset specification by providing different layers of result set encapsulation. The obvious use is the one I outlined previously—hiding a result set behind a JavaBeans-friendly interface. It is thus likely that driver vendors will provide a rowset implementation that supports direct access to their database. Because the rowset API does not require ...

Get Database Programming with JDBC & Java, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.