db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-6773) Derby throws plain SQLIntegrityConstraintViolationException
Date Sun, 12 Apr 2015 20:32:12 GMT

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

Bryan Pendleton commented on DERBY-6773:

Hmmm... Trying to code my idea, I discover that the client-side SqlException is
constructed with the Sqlca object. That is, the constructor we actually run is:

     * Create an exception for an engine generated error.
     * @param logWriter object used for tracing
     * @param sqlca the SQLCA sent from the server
    public SqlException(LogWriter logWriter, Sqlca sqlca) {
        this(sqlca, 0, true);
        // only set the error code for the first exception in the chain (we
        // don't know the error code for the rest)
        errorcode_ = sqlca.getErrorCode();
        if ( logWriter != null )

So I'll have to do more study to figure out how to crack open the Sqlca
and get the message arguments out of it.

> 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:
>         Environment: Windows 7 x86_64, Java
>            Reporter: Jochen Wiedmann
>            Assignee: Abhinav Gupta
>            Priority: Minor
>         Attachments: CallSuper.diff, DERBY6733Repro.java, SamePackage.diff, SharedException.diff,
ant -verbose build all.txt
> 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

View raw message