Posted by jonbruce
on June 15, 2004 at 9:55 AM PDT
Exception chaining has become an increasingly popular pattern as a way to better manage exceptions. As part of JDBC 4.0, we are giving consideration to introducing exception chaining to the primary exception class definition:
Our thoughts on introducing exception chaining are centered on much of the feedback we received from the JDBC RowSet Implementations 1.0 release, both from public forums such as ServerSide and on feedback email aliases.
By defining a group of methods that allow a
Throwable instance to be set at the
SQLException level, this allow related exceptions definition introduced in JDBC RowSets to also provide chaining support. Overloading the current set of constructors should achieve chaining functionality and compliment the four other currently defined constructors .
public SQLException(Throwable cause);
public SQLException(String reason, Throwable cause);
public SQLException(String reason, String sqlState, Throwable cause);
Intertwining this with a an additional proposal underway in JDBC 4.0 which is looking to provide a limited set of exceptions that relate directly to SQL State definitions should provide an improved standard API so developers can more easily port the applications between different SQL data sources.
I guess I am writing with my Specification Lead hat on here, but I also want to be sure we correctly gauge the needs of the community, so I encourage you all to add your comments below. Over the next few weeks I also intend to write about how JDBC 4.0 is progressing and gauge the communities position as we progress through the Java Community Process.