java.sql.SQLIntegrityConstraintViolationException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Re: Derby DB up-to-date?
    via by Karl Wright,
  • Re: Derby DB up-to-date?
    via by Karl Wright,
  • Re: Derby DB up-to-date?
    via by Karl Wright,
  • primary key constraint violation on autoincrement id
    via by smcintyre@esriaustralia.com.au,
  • AW: primary key constraint violation on autoincrement id
    via by Malte.Kempff@de.equens.com,
  • Here's my setup: As my destination, I set up HL7 Inspector to listen on port 6660. In Mirth Connect, create a channel with a Channel Reader as the source, TCP Sender (MLLP transmission mode) sending to 6660 as the destination. For Queue Settings, set to Attempt First. Leave everything else as defaults. With HL7 Inspector listening, send a message to the channel. Sends through fine. Now, stop HL7 Inspector. Send another message to the channel. Since HL7 Inspector is no longer listening, the message is queued. Everything good so far. Now go into the message view for the channel and delete the message. The message data is gone. Start the HL7 Inspector listening again. Even though the message has been deleted, on each retry interval, you get the following exception in the server log: 2013-08-24 09:52:16,708] ERROR (com.mirth.connect.connectors.tcp.TcpDispatcher:498): Error processing queued message 2-1 (SENT) for channel 13e934ea-410b-44d7-acc4-a800cc83cf22 (Destination 1). This error is expected if the message was manually removed from the queue. com.mirth.connect.donkey.server.data.DonkeyDaoException: java.sql.SQLIntegrityConstraintViolationException: INSERT on table 'D_MC2' caused a violation of foreign key constraint 'MC2_FKEY' for key (2,1). The statement has been rolled back. at com.mirth.connect.donkey.server.data.jdbc.JdbcDao.storeContent(JdbcDao.java:289) at com.mirth.connect.donkey.server.data.jdbc.JdbcDao.storeMessageContent(JdbcDao.java:222) at com.mirth.connect.donkey.server.data.buffered.BufferedDao.executeTasks(BufferedDao.java:103) at com.mirth.connect.donkey.server.data.buffered.BufferedDao.commit(BufferedDao.java:74) at com.mirth.connect.donkey.server.data.buffered.BufferedDao.commit(BufferedDao.java:61) at com.mirth.connect.donkey.server.channel.DestinationConnector.run(DestinationConnector.java:486) at java.lang.Thread.run(Thread.java:680)Caused by: java.sql.SQLIntegrityConstraintViolationException: INSERT on table 'D_MC2' caused a violation of foreign key constraint 'MC2_FKEY' for key (2,1). The statement has been rolled back. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown Source) at com.mirth.connect.donkey.server.data.jdbc.JdbcDao.storeContent(JdbcDao.java:285) ... 6 moreCaused by: java.sql.SQLException: INSERT on table 'D_MC2' caused a violation of foreign key constraint 'MC2_FKEY' for key (2,1). The statement has been rolled back. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source) ... 17 moreCaused by: ERROR 23503: INSERT on table 'D_MC2' caused a violation of foreign key constraint 'MC2_FKEY' for key (2,1). The statement has been rolled back. at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) at org.apache.derby.impl.sql.execute.ForeignKeyRIChecker.doCheck(Unknown Source) at org.apache.derby.impl.sql.execute.GenericRIChecker.doCheck(Unknown Source) at org.apache.derby.impl.sql.execute.RISetChecker.doFKCheck(Unknown Source) at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(Unknown Source) at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown Source) at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source) at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source) ... 11 more Additionally, HL7 Inspector will now receive the message over and over again (whatever the retry interval is). And since the message data is deleted, the only recourse is to stop/undeploy the channel.
    via by Eric Butterfield,
  • We're building some pretty big EARs and deploying them nightly to our Artifactory server. Once an EAR gets bigger than 50MB it won't deploy any more. At first I though this was a Jetty issue, as I was getting an HTTP code 413, so I configured Jetty to accept requests up to 100MB (roughly) following a tip from someone on their mailing list: -Dorg.mortbay.jetty.Request.maxFormContentSize=100000000 Upon inspecting the artifactoy log file, I found this, which *roughly* matches the time the deployment should be occurring: 2008-06-09 19:32:23,562 [ERROR] (RepoFilter.java:151{10}) - Upload request failed java.io.IOException: Es steht nicht genug Speicherplatz auf dem Datentr?ger zur Verf?gung at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(FileOutputStream.java:260) at org.apache.jackrabbit.core.value.BLOBFileValue.<init>(BLOBFileValue.java:152) at org.apache.jackrabbit.core.value.BLOBFileValue.<init>(BLOBFileValue.java:121) at org.apache.jackrabbit.core.value.InternalValue.create(InternalValue.java:197) at org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:753) at org.apache.jackrabbit.core.NodeImpl.setProperty(NodeImpl.java:2340) at org.artifactory.jcr.JcrHelper.importStream(JcrHelper.java:338) at org.artifactory.repo.JcrRepo$8.doInJcr(JcrRepo.java:406) Which is followed shortly after by this: 2008-06-09 19:32:39,640 [ERROR] (MultiIndex.java:1057{10}) - Unable to commit volatile index java.io.IOException: Unable to create directory: C:\Program Files\artifactory-1.2.5\bin\..\data\jcr\workspaces\default\index\_j9f at org.apache.jackrabbit.core.query.lucene.MultiIndex.newIndexFolder(MultiIndex.java:1020) at org.apache.jackrabbit.core.query.lucene.MultiIndex.getOrCreateIndex(MultiIndex.java:524) at org.apache.jackrabbit.core.query.lucene.MultiIndex$CreateIndex.execute(MultiIndex.java:1575) ... the disk in question has about 15GB left and the file I'm trying to upload is just over 50MB, so all should be well. I'm also seeing some other exceptions in the log, but I'm thinking they're unrelated; I've included them here because maybe I'm mistaken and they are relevant ;) 2008-06-10 01:20:49,890 [ERROR] (DatabasePersistenceManager.java:472{10}) - failed to write property state: 25fd6399-bb8a-4cc7-be2d-3646668c5dc8/{http://www.jcp.org/jcr/1.0}data 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 'DEFAULT_PROP_IDX' defined on 'DEFAULT_PROP'. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
    via by Clive Jevons,
  • In italy we have names with single quote in patient names like " ' ": d'onofrio, d'avellano,d'allonzo ..... The error I receive is: Aug 11, 2010 10:50:06 AM in.raster.mayam.util.database.DatabaseHandler insertPatientData SEVERE: null java.sql.SQLSyntaxErrorException: Syntax error: Encountered "onofrio" at line 1, column 59. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) .......... at java.lang.Thread.run(Thread.java:619) Caused by: java.sql.SQLException: Syntax error: Encountered "onofrio" at line 1, column 59. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source) ... 24 more Aug 11, 2010 10:50:06 AM in.raster.mayam.util.database.DatabaseHandler insertStudyData SEVERE: null java.sql.SQLIntegrityConstraintViolationException: INSERT on table 'STUDY' caused a violation of foreign key constraint 'SQL100616050025040' for key (CTPETPI1_CTPET-0074684728). The statement has been rolled back. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) we need a method to escape the characters in a String to be suitable to pass to an SQL query. If I do (from jdbc docs) : static public String escapeLine(String s) { String retvalue = s; if (s.indexOf ("'") != -1 ) { StringBuffer hold = new StringBuffer(); char c; for(int i=0; i < s.length(); i++ ) { if ((c=s.charAt(i)) == '\'' ) { hold.append ("''"); }else { hold.append(c); } } retvalue = hold.toString(); } return retvalue; } conn.createStatement().execute("insert into " + patientTable + " values('" + escapeLine(dataset.getString(Tag.PatientID)) + "','" +escapeLine( dataset.getString(Tag.PatientName)) + "'," + dat + ",'" + dataset.getString(Tag.PatientSex) + "')"); it works !! Do you know some other method in order to do so ?? (PreparedStatement ??) Or I can Commit this? Paolo
    via by Paolo Marcheschi,
  • We're building some pretty big EARs and deploying them nightly to our Artifactory server. Once an EAR gets bigger than 50MB it won't deploy any more. At first I though this was a Jetty issue, as I was getting an HTTP code 413, so I configured Jetty to accept requests up to 100MB (roughly) following a tip from someone on their mailing list: -Dorg.mortbay.jetty.Request.maxFormContentSize=100000000 Upon inspecting the artifactoy log file, I found this, which *roughly* matches the time the deployment should be occurring: 2008-06-09 19:32:23,562 [ERROR] (RepoFilter.java:151{10}) - Upload request failed java.io.IOException: Es steht nicht genug Speicherplatz auf dem Datentr?ger zur Verf?gung at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(FileOutputStream.java:260) at org.apache.jackrabbit.core.value.BLOBFileValue.<init>(BLOBFileValue.java:152) at org.apache.jackrabbit.core.value.BLOBFileValue.<init>(BLOBFileValue.java:121) at org.apache.jackrabbit.core.value.InternalValue.create(InternalValue.java:197) at org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:753) at org.apache.jackrabbit.core.NodeImpl.setProperty(NodeImpl.java:2340) at org.artifactory.jcr.JcrHelper.importStream(JcrHelper.java:338) at org.artifactory.repo.JcrRepo$8.doInJcr(JcrRepo.java:406) Which is followed shortly after by this: 2008-06-09 19:32:39,640 [ERROR] (MultiIndex.java:1057{10}) - Unable to commit volatile index java.io.IOException: Unable to create directory: C:\Program Files\artifactory-1.2.5\bin\..\data\jcr\workspaces\default\index\_j9f at org.apache.jackrabbit.core.query.lucene.MultiIndex.newIndexFolder(MultiIndex.java:1020) at org.apache.jackrabbit.core.query.lucene.MultiIndex.getOrCreateIndex(MultiIndex.java:524) at org.apache.jackrabbit.core.query.lucene.MultiIndex$CreateIndex.execute(MultiIndex.java:1575) ... the disk in question has about 15GB left and the file I'm trying to upload is just over 50MB, so all should be well. I'm also seeing some other exceptions in the log, but I'm thinking they're unrelated; I've included them here because maybe I'm mistaken and they are relevant ;) 2008-06-10 01:20:49,890 [ERROR] (DatabasePersistenceManager.java:472{10}) - failed to write property state: 25fd6399-bb8a-4cc7-be2d-3646668c5dc8/{http://www.jcp.org/jcr/1.0}data 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 'DEFAULT_PROP_IDX' defined on 'DEFAULT_PROP'. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
    via by Clive Jevons,
    • java.sql.SQLIntegrityConstraintViolationException: Instrukcja została przerwana, ponieważ mogła spowodować powstanie duplikatu wartości klucza w regule ograniczającej klucz unikalny lub podstawowy albo w unikalnym indeksie identyfikowanym przez obiekt 'C1338469165883' zdefiniowany dla 'EVENTS'. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown Source) at org.apache.manifoldcf.core.database.Database.execute(Database.java:839) at org.apache.manifoldcf.core.database.Database$ExecuteQueryThread.run(Database.java:640)

    Users with the same issue

    davidvanlaatumdavidvanlaatum
    20 times, last one,