JDBC 3.0

At the time of this writing, Version 3.0 of the JDBC API was in its fourth proposed final draft, and was on target for inclusion in J2SE and J2EE Version 1.4. JDBC 3.0 adds increased support for SQL99 features, increasingly capable transaction support, full read/write handling of BLOB and CLOB fields, URL datatypes, and various minor enhancements to the rest of the API. JDBC 3.0 adds a number of methods to the DatabaseMetaData interface, allowing programmers to determine which new features are supported.

JDBC 3.0 is also intended to integrate well with the J2EE Connector standard, allowing drivers and configuration information to be packaged into a Resource adapter ARchive, or RAR file. This allows easier deployment of JDBC connections into a J2EE server, but doesn’t change the way programmers interact with the API.

Savepoints

Savepoints allow transactions to be partially rolled back. If the underlying database and driver support the functionality, the new setSavepoint(String name) method of Connection creates a named savepoint in the current transaction, and returns an object implementing the Savepoint interface. The object can be passed to the rollback( ) method of Connection to roll back all components of the current transaction that took place after the setSavepoint( ) method was called:

Statement stmt = con.createStatement( ); stmt.executeUpdate("delete from clients"); stmt.executeUpdate("insert into clients (NAME, ID) values ('Charles Babbage', 1)"); Savepoint ...

Get Java Enterprise in a Nutshell, 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.