title: Getting DB2 SQL Error: SQLCODE=-803, SQLSTATE=23505 from DB2
body: <p>I am executing this sql from jpa-hibernate for a db2 database: </p>
  
  <p>update SCO_IC_RELACIONES_PAISES set IC_ID=null where IC_ID=2 and ID=12</p>
  
  <p>The error I am getting is: </p>
  
  <pre><code>2018-06-14 18:21:47,203 ERROR 1 --- [http-nio-8080-exec-5] org.hibernate.engine.jdbc.spi.SqlExceptionHelper ::: **DB2 SQL Error: SQLCODE=-803, SQLSTATE=23505, SQLERRMC=2;SCOPEDES.SCO_IC_RELACIONES_PAISES, DRIVER=4.24.92**
  
  2018-06-14 18:21:47,203 ERROR 1 --- [http-nio-8080-exec-5] org.hibernate.internal.ExceptionMapperStandardImpl ::: HHH000346: **Error during managed flush [org.hibernate.exception.ConstraintViolationException**: could not execute statement]
  </code></pre>
  
  <p>The wierd thing is that if I execute the same sql from a db2 client(like oracle sql developer), the update is successful. </p>
  
  <ol>
  <li>The error I am getting is from database or is from hibernate before sending the sql to database? If it is from database, why if I execute directly the sql on a db2 client, the sql is executed ok?</li>
  </ol>
  
  <p>Attached image with table structure</p>
  
  <p><a href="https://i.stack.imgur.com/y96tM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y96tM.png" alt="enter image description here"></a></p>
  
  <p>Thanks</p>