commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Graham <>
Subject Re: [DbUtils] DbUtils.close methods
Date Wed, 02 Jun 2004 13:00:56 GMT

--- Mikhail Krivoshein <> wrote:
> Hello all,
> Message of Petr Hollay forced me to consider is it right to throw 
> SQLException from QueryRunner.query(), .update() etc in case of error in
> DbUtils.close().
> To be clear I'd like to say that I'm developing premium content delivery
> system now. So if you will devliver content - you will get some money, 
> if you won't deliver - you will get nothing, except expenses. In such 
> content I'd like to send content even if I got some error during 
> ResultSet, PreparedStatement and/or Connection close operations. But if 
> current design it is unpossible to distinguish such case and case when 
> another database errors occur.
> Considering this I'm asking for more structured Exceptions handling in 
> DbUtils library. At least in QueryRunner.
> Good solution is to define set of custom exception classes 
> (ConnectionException, QueryException, CloseExceptions, etc) and embedd 
> actual SQLException objects into them as cause property value. But it 
> makes current version of DbUtils incompatible with
> previous versions.
> Another solution is to derive all this custom exception classes from 
> SQLException, so old applications remains compatible.
> Looking forward for comments.

DbUtils is meant to handle the most common JDBC use cases.  I've never
seen an SQLException thrown from a close operation unless there was a
previous error with the connection, statement, or result set.

Instead of developing our own exception class hierarchy maybe we should
provide protected close() methods in QueryRunner.  The default
implementation would call DbUtils.close() but you could override it to
perform special handling.


> Best regards,
> Mikhail Krivoshein
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger. 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message