java.io.IOException: Error talking to database: Problem with constraints script /opt/webservers/fecru-2.6.0_initial/sql/MYSQL/schema/constraints_73.sql

Atlassian JIRA | Cezary Zawadka | 3 years ago
  1. 0

    [FE-4983] Failing migration from Crucible with FishEye v2.6.0 -> 3.1.5 - Atlassian JIRA

    atlassian.com | 1 year ago
    java.io.IOException: Error talking to database: Problem with constraints script /opt/webservers/fecru-2.6.0_initial/sql/MYSQL/schema/constraints_73.sql
  2. 0

    Migration of version 2.6.0 to a newer one (3.1.5) fails with following error: {noformat} java.io.IOException: Error talking to database: Problem with constraints script /opt/webservers/fecru-2.6.0_initial/sql/MYSQL/schema/constraints_73.sql at com.atlassian.crucible.migration.item.SQLBackup.restore(SQLBackup.java:206) at com.atlassian.crucible.migration.item.SQLBackup$1.restore(SQLBackup.java:173) at com.cenqua.fisheye.ctl.Restore.run(Restore.java:166) at com.cenqua.fisheye.ctl.Restore.main(Restore.java:235) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.cenqua.fisheye.FishEyeCtl.mainImpl(FishEyeCtl.java:114) at com.cenqua.fisheye.FishEyeCtl.main(FishEyeCtl.java:42) Caused by: com.cenqua.crucible.hibernate.CruDBException: Problem with constraints script /opt/webservers/fecru-2.6.0_initial/sql/MYSQL/schema/constraints_73.sql at com.cenqua.crucible.hibernate.DefaultDBControl.addConstraints(DefaultDBControl.java:318) at com.atlassian.crucible.migration.item.DBImporter.importData(DBImporter.java:159) at com.atlassian.crucible.migration.item.SQLBackup.restore(SQLBackup.java:192) ... 9 more Caused by: com.cenqua.crucible.hibernate.CruDBException: SQL script error on line 115: "alter table cru_revision add index FKE2F52A1434AAD25A (cru_path), add constraint FKE2F52A1434AAD25A foreign key (cru_path) references cru_stored_path (cru_path_id);" (Cannot add or update a child row: a foreign key constraint fails (`sources_RC1`.`#sql-1b16_1142`, CONSTRAINT `FKE2F52A1434AAD25A` FOREIGN KEY (`cru_path`) REFERENCES `cru_stored_path` (`cru_path_id`))), please contact http://www.atlassian.com/support/ at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:484) at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:415) at com.cenqua.crucible.hibernate.DefaultDBControl.addConstraints(DefaultDBControl.java:312) ... 11 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`sources_RC1`.`#sql-1b16_1142`, CONSTRAINT `FKE2F52A1434AAD25A` FOREIGN KEY (`cru_path`) REFERENCES `cru_stored_path` (`cru_path_id`)) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1038) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2687) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1647) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566) at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:456) ... 13 more {noformat} h3. Workaround It is caused by inconsistency between {{cru_revision}} and {{cru_path}} tables which can be fixed using SQL statements: {code} delete from cru_revision where cru_path not in (select cru_path_id from cru_stored_path); delete from cru_fr_detail where cru_revision_id not in (select cru_revision_id from cru_revision); {code}

    Atlassian JIRA | 3 years ago | Cezary Zawadka
    java.io.IOException: Error talking to database: Problem with constraints script /opt/webservers/fecru-2.6.0_initial/sql/MYSQL/schema/constraints_73.sql
  3. 0

    Migration of version 2.6.0 to a newer one (3.1.5) fails with following error: {noformat} java.io.IOException: Error talking to database: Problem with constraints script /opt/webservers/fecru-2.6.0_initial/sql/MYSQL/schema/constraints_73.sql at com.atlassian.crucible.migration.item.SQLBackup.restore(SQLBackup.java:206) at com.atlassian.crucible.migration.item.SQLBackup$1.restore(SQLBackup.java:173) at com.cenqua.fisheye.ctl.Restore.run(Restore.java:166) at com.cenqua.fisheye.ctl.Restore.main(Restore.java:235) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.cenqua.fisheye.FishEyeCtl.mainImpl(FishEyeCtl.java:114) at com.cenqua.fisheye.FishEyeCtl.main(FishEyeCtl.java:42) Caused by: com.cenqua.crucible.hibernate.CruDBException: Problem with constraints script /opt/webservers/fecru-2.6.0_initial/sql/MYSQL/schema/constraints_73.sql at com.cenqua.crucible.hibernate.DefaultDBControl.addConstraints(DefaultDBControl.java:318) at com.atlassian.crucible.migration.item.DBImporter.importData(DBImporter.java:159) at com.atlassian.crucible.migration.item.SQLBackup.restore(SQLBackup.java:192) ... 9 more Caused by: com.cenqua.crucible.hibernate.CruDBException: SQL script error on line 115: "alter table cru_revision add index FKE2F52A1434AAD25A (cru_path), add constraint FKE2F52A1434AAD25A foreign key (cru_path) references cru_stored_path (cru_path_id);" (Cannot add or update a child row: a foreign key constraint fails (`sources_RC1`.`#sql-1b16_1142`, CONSTRAINT `FKE2F52A1434AAD25A` FOREIGN KEY (`cru_path`) REFERENCES `cru_stored_path` (`cru_path_id`))), please contact http://www.atlassian.com/support/ at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:484) at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:415) at com.cenqua.crucible.hibernate.DefaultDBControl.addConstraints(DefaultDBControl.java:312) ... 11 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`sources_RC1`.`#sql-1b16_1142`, CONSTRAINT `FKE2F52A1434AAD25A` FOREIGN KEY (`cru_path`) REFERENCES `cru_stored_path` (`cru_path_id`)) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1038) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2687) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1647) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566) at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:456) ... 13 more {noformat} h3. Workaround It is caused by inconsistency between {{cru_revision}} and {{cru_path}} tables which can be fixed using SQL statements: {code} delete from cru_revision where cru_path not in (select cru_path_id from cru_stored_path); delete from cru_fr_detail where cru_revision_id not in (select cru_revision_id from cru_revision); {code}

    Atlassian JIRA | 3 years ago | Cezary Zawadka
    java.io.IOException: Error talking to database: Problem with constraints script /opt/webservers/fecru-2.6.0_initial/sql/MYSQL/schema/constraints_73.sql
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    TableCreation fails

    GitHub | 4 years ago | fabianschwarzfritz
    com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`yetanothercalendar`.`events`, CONSTRAINT `events_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `users` (`id`))
  6. 0

    Delete from or Insert into database using Java GUI

    Stack Overflow | 4 years ago | Animachine
    com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'Mark Renshaw' for key 'PRIMARY'

  1. jshakil 1 times, last 1 month ago
  2. Kialandei 1 times, last 1 week ago
  3. DoktorDoener666 6 times, last 3 weeks ago
  4. mauritius 1 times, last 3 weeks ago
  5. MoYapro 1 times, last 3 weeks ago
11 more registered users
45 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException

    Cannot add or update a child row: a foreign key constraint fails (`sources_RC1`.`#sql-1b16_1142`, CONSTRAINT `FKE2F52A1434AAD25A` FOREIGN KEY (`cru_path`) REFERENCES `cru_stored_path` (`cru_path_id`))

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0()
  2. Java RT
    Constructor.newInstance
    1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    4. java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    4 frames
  3. MySQL jdbc
    StatementImpl.executeUpdate
    1. com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    2. com.mysql.jdbc.Util.getInstance(Util.java:381)
    3. com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1038)
    4. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563)
    5. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495)
    6. com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
    7. com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
    8. com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2687)
    9. com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1647)
    10. com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566)
    10 frames
  4. com.cenqua.crucible
    DefaultDBControl.addConstraints
    1. com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:456)
    2. com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:415)
    3. com.cenqua.crucible.hibernate.DefaultDBControl.addConstraints(DefaultDBControl.java:312)
    3 frames
  5. com.atlassian.crucible
    SQLBackup$1.restore
    1. com.atlassian.crucible.migration.item.DBImporter.importData(DBImporter.java:159)
    2. com.atlassian.crucible.migration.item.SQLBackup.restore(SQLBackup.java:192)
    3. com.atlassian.crucible.migration.item.SQLBackup$1.restore(SQLBackup.java:173)
    3 frames
  6. com.cenqua.fisheye
    Restore.main
    1. com.cenqua.fisheye.ctl.Restore.run(Restore.java:166)
    2. com.cenqua.fisheye.ctl.Restore.main(Restore.java:235)
    2 frames
  7. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    4. java.lang.reflect.Method.invoke(Method.java:597)
    4 frames
  8. com.cenqua.fisheye
    FishEyeCtl.main
    1. com.cenqua.fisheye.FishEyeCtl.mainImpl(FishEyeCtl.java:114)
    2. com.cenqua.fisheye.FishEyeCtl.main(FishEyeCtl.java:42)
    2 frames