Re: error handling...

From: Christophe Vanfleteren (c.v4nfl3t3r3n_at_pandora.be)
Date: 03/22/04


Date: Mon, 22 Mar 2004 09:42:57 GMT

Robert Klemme wrote:

>><http://java.sun.com/j2se/1.4.2/docs/api/java/sql/SQLException.html#getErrorCode()>
>
> This code is vendor specific. But if you stick to PostGres that might be
> ok for you.
>
> Kind regards
>
> robert
>
> Sun did a very bad job at error handling in JDBC: there is just one
> exception type where there should have been multiple types to allow for
> more precise error handling. There should be at least some exceptions for
> basic events such as connection errors, constraint violations, objects not
> found etc.
>
I most definitely agree. That is why I also mentioned the JDBC support in
the Spring framework.

When you look at
<http://www.springframework.org/docs/api/org/springframework/dao/DataAccessException.html>
you'll see a nice hierarchy of exceptions. You also no longer have to worry
about vendor specific errorcodes, since Spring translates these into the
right kind of exception for you.

Also nice thing about Spring is that it uses the same exception hiearchy for
different persistence frameworks, like JDBC, Hibernate and JDO.

-- 
Kind regards,
Christophe Vanfleteren


Relevant Pages

  • Re: error handling...
    ... > Robert Klemme wrote: ... >> This code is vendor specific. ... > the Spring framework. ... > right kind of exception for you. ...
    (comp.lang.java.databases)
  • Re: Select distinct or group by does not work
    ... > Robert Klemme wrote: ... dark. ... I simply asked what was the exception. ... Kind regards ...
    (comp.lang.java.databases)
  • Re: Help on searching large sets of data
    ... Robert Klemme wrote: ... Solr doesn't - judging from their website. ... Kind regards ...
    (comp.lang.ruby)
  • Re: File.delete -> Permission denied
    ... Kind regards, ... I'm new to Ruby and I already have trouble. ... File.delete can't deal with directories, so it raises an exception. ...
    (comp.lang.ruby)
  • [HV-HIGH] MS Word multiple exceptions, at least one exploitable
    ... There are two exception types, ... It is possible to trigger two other "access violation" conditions by modifying ... At the time of release vendor was not aware of the vulnerability. ... HexView does not notify vendors unless there is a prior agreement to do so. ...
    (Bugtraq)