Re: error handling...
From: Christophe Vanfleteren (c.v4nfl3t3r3n_at_pandora.be)
Date: 03/22/04
- Next message: Bob Bie: "Re: error handling..."
- Previous message: Robert Klemme: "Re: error handling..."
- In reply to: Robert Klemme: "Re: error handling..."
- Next in thread: Robert Klemme: "Re: error handling..."
- Reply: Robert Klemme: "Re: error handling..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Bob Bie: "Re: error handling..."
- Previous message: Robert Klemme: "Re: error handling..."
- In reply to: Robert Klemme: "Re: error handling..."
- Next in thread: Robert Klemme: "Re: error handling..."
- Reply: Robert Klemme: "Re: error handling..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|