db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David W. Van Couvering" <David.Vancouver...@Sun.COM>
Subject DERBY-852 - client SqlException no longer extends java.sql.SQLException
Date Mon, 23 Jan 2006 16:03:48 GMT
As of revision 371561 I have modified the client code so that 
client.am.SqlException no longer extends java.sql.SQLException.

What this means is that public methods throw java.sql.SQLException while 
internal methods throw client.am.SqlException.  The public methods then 
catch SqlException and then use the method getSQLException() to throw a 
java.sql.SQLException for that SqlException.  This is very similar to 
what happens on the engine side where StandardException is transformed 
into SQLException.

Sometimes internal methods call public JDBC methods.  In these cases you 
have to have the following pattern:

try {
   publicMethod()
} catch ( SQLException sqle ) {
   throw new SqlException(sqle)
}

The SQLException is wrapped inside a SqlException and is unwrapped at a 
later point when the exception is thrown to the application.  This 
prevents a chain of dependencies where if one internal method throws 
SQLException then many more have to throw it.

Comments and questions most welcome.

David

Mime
View raw message