You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Bryan Pendleton (JIRA)" <ji...@apache.org> on 2015/02/27 02:33:05 UTC

[jira] [Commented] (DERBY-6773) Derby throws plain SQLIntegrityConstraintViolationException

    [ https://issues.apache.org/jira/browse/DERBY-6773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14339546#comment-14339546 ] 

Bryan Pendleton commented on DERBY-6773:
----------------------------------------

Hi Abhinav,

Have you been able to reproduce this problem on your computer? Here's what I did to get the repro running:

1) I built the Derby trunk by doing 'cd trunk', 'ant all', and 'ant buildjars'.
2) I copied the DERBY6773Repro.java into a clean directory and set my classpath:
    set CLASSPATH=.;C:\Users\bryan\derby\trunk\java\sane\derby.jar
3) javac DERBY6773Repro.java
4) java DERBY6773Repro.java

The repro program then runs in my command window and generates the exception.

In the output, I see, as described, that the exception is:

java.sql.SQLIntegrityConstraintViolationException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'UK_APPLICATION_NAME' defined on 'APPLICATION'.

Note that I use 'ant' to build the Derby Java code from the command line; I do not use Eclipse to build it. I find that the easiest and most reliable way to build the Derby code is to use Ant from the command line.

> Derby throws plain SQLIntegrityConstraintViolationException
> -----------------------------------------------------------
>
>                 Key: DERBY-6773
>                 URL: https://issues.apache.org/jira/browse/DERBY-6773
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.10.2.0
>         Environment: Windows 7 x86_64, Java 1.6.0.45
>            Reporter: Jochen Wiedmann
>            Assignee: Abhinav Gupta
>            Priority: Minor
>         Attachments: DERBY6733Repro.java
>
>
> If a unique constraint is violated by an insert statement, then Derby throws an SQLIntegrityConstraintViolationException. The error message contains, in particular, the constraint name and the table name.
> To distinguish between cases with various constraints, Derby should instead throw a subclass of SQLIntegrityConstraintViolationException, with methods like getConstraintName(), and getTableName().
> See also https://hibernate.atlassian.net/browse/HHH-9516.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)