Re: Please help! - Constraints Exception

Поиск
Список
Период
Сортировка
Искать
От
Dennis Brakhane
Тема
Re: Please help! - Constraints Exception
Дата
Msg-id
226a19190906171304n2b306a0ufc676ad7be76b0e1@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Please help! - Constraints Exception Ivan Bojer <ibojer@gmail.com>
Re: Please help! - Constraints Exception Dennis Brakhane <brakhane@googlemail.com>
Re: Please help! - Constraints Exception Dennis Brakhane <brakhane@googlemail.com>
Re: Please help! - Constraints Exception Ivan Bojer <ibojer@gmail.com>
On Wed, Jun 17, 2009 at 9:57 PM, Ivan Bojer wrote:
> I have a table with UNIQUE constraint on the column. Inserting 2 of
> same values on it fails (as it should)
> and I can see DBLog Error message. Alas, there is no exception thrown
> from JDBC so that I can properly
> handle it.

This is from memory, so if I talk nonsense, I hope somebody corrects me.

The exception thrown should be a SQLException. These have a
"getSQLState" method which returns a string. If this string is
"23505", you have a UNIQUE violation.

You can see the possible error codes here:

http://www.postgresql.org/docs/8.3/static/errcodes-appendix.html
В списке pgsql-jdbc по дате отправления
От: Dennis Brakhane
Дата:
От: Ivan Bojer
Дата:
FAQ