Constraint violation in MSSQL when creating review

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Fisheye/Crucible is connected to MSSQL.

Failed to create review for certain commits.

The following appears in the atlassian-fisheye-<date>.log:

2014-03-28 05:43:26,267 WARN  [btpool0-66 ] org.hibernate.util.JDBCExceptionReporter JDBCExceptionReporter-logExceptions - SQL Error: 2627, SQLState: 23000
2014-03-28 05:43:26,268 ERROR [btpool0-66 ] org.hibernate.util.JDBCExceptionReporter JDBCExceptionReporter-logExceptions - Violation of UNIQUE KEY constraint 'UQ__cru_revi__21F7C44C19DFD96B'. Cannot insert duplicate key in object 'dbo.cru_revision'. The duplicate key value is (REPONAME, <pathID>, <COMMIT_HASH>).
2014-03-28 05:43:26,268 ERROR [btpool0-66 ] org.hibernate.event.def.AbstractFlushingEventListener AbstractFlushingEventListener-performExecutions - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: could not insert: [com.cenqua.crucible.model.CrucibleRevision]

Diagnosis

Run the following SQL query in Fisheye/Crucible database:

Select TABLE_NAME, COLUMN_NAME, COLLATION_NAME From INFORMATION_SCHEMA.COLUMNS

Check if there is any collation name with "CI_AS" (CI means Case Insensitive).

Cause

Fisheye/Crucible only works with Case Sensitive collation set as stated in Migrating to SQL Server.

Resolution

  1. Create a new MSSQL database with Latin1_General_CS_AS collation set.
  2. Migrate Fisheye/Crucible to the new database at Administration > System Settings > Database.
Last modified on Jul 31, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.