java.sql.SQLException

Got error 893 'Constraint violation e.g. duplicate value in unique index' from NDB

Samebug tips1

MySQL doesn't support some types of characters (such as emojis) with the utf8 encoding. You need to be on MySQL 5.5+ and force utf8mb4 (everywhere, client and server). You can do this sending the query "SET NAMES utf8mb4". Check this https://goo.gl/3E2qzg

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web10929

  • Got error 893 'Constraint violation e.g. duplicate value in unique index' from NDB
  • via Oracle Community by 948133, 1 year ago
    error in script file line: 13814 org.hsqldb.HsqlException: Violation of unique constraint SYS_PK_244: duplicate value(s) for column(s) ID
  • via GitHub by macqueen
    , 8 months ago
    Violation of unique constraint MY_ENTITY_UK_1: duplicate value(s) for column(s) MY_COLUMN in statement [...]
  • Stack trace

    • java.sql.SQLException: Got error 893 'Constraint violation e.g. duplicate value in unique index' from NDB at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3536) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3468) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1957) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2107) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2086) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2371) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2289) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2274) at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:365) at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.executeInsert(JDBCAbstractCreateCommand.java:366) at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.performInsert(JDBCAbstractCreateCommand.java:322) at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.execute(JDBCAbstractCreateCommand.java:151)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    3 times, 3 weeks ago
    Once, 1 month ago
    Once, 1 month ago
    2 times, 2 months ago
    4 times, 2 months ago
    153 more bugmates