Hi,

Sorry for the delay. I see the problem now. The error code was changed
because originally H2 didn't use the "correct" (as defined by the SQL
standard) value. There are multiple solutions:

- move the ErrorCode class to org.h2.api

- use SQLIntegrityConstraintViolationException instead of SQLException

Which one would you prefer? Or would it make sense to do both?

Regards,
Thomas



2012/2/29 András Péteri <[email protected]>:
> Hello,
>
> in Eclipse's CDO project, unique key violations are detected by extracting
> the SQL state from the caught exception, differences in reported codes are
> handled by database adapter classes. Making ErrorCode available would help
> maintain consistent behaviour for different versions of H2; please see the
> related bug report at [1].
>
> [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=369775
>
> --
> András
>
>
> On Saturday, May 14, 2011 11:42:24 AM UTC+2, Thomas Mueller wrote:
>>
>> Hi,
>>
>> What kind of errors do you need to handle?
>>
>> In theory, your application should be written so that it works with all
>> databases. I know this is not always possible... In a perfect world, all
>> databases would return the same SQL state for the same exception, and the
>> list of SQL states would be part of the JDBC API (similar to
>> java.sql.Types).
>>
>> If hardcoding the SQL state in your application is not an option, I could
>> move the ErrorCode class to org.h2.api, the other (easier) solution is to
>> include org.h2.constant.* to the list of exported packages. But first I
>> would like to better understand the problem.
>>
>> Regards,
>> Thomas
>>
>
> On Saturday, May 14, 2011 11:42:24 AM UTC+2, Thomas Mueller wrote:
>>
>> Hi,
>>
>> What kind of errors do you need to handle?
>>
>> In theory, your application should be written so that it works with all
>> databases. I know this is not always possible... In a perfect world, all
>> databases would return the same SQL state for the same exception, and the
>> list of SQL states would be part of the JDBC API (similar to
>> java.sql.Types).
>>
>> If hardcoding the SQL state in your application is not an option, I could
>> move the ErrorCode class to org.h2.api, the other (easier) solution is to
>> include org.h2.constant.* to the list of exported packages. But first I
>> would like to better understand the problem.
>>
>> Regards,
>> Thomas
>>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/h2-database/-/EtuaGZaaAHwJ.
>
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to