Hi,
We have a java program compiled by Java 1.8 and this program uses ojdbc7.jar.
The database is Oracle RAC 12.1.0.2.
Here is the code snippet.
conn.setAutoCommit(true);
pstmt = conn.prepareStatement("update mytable set datafield='xxxx' where keyfield='yyyy'");
int rows = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
if(rows == 0) {
pstmt = conn.prepareStatement("insert into mytable(keyfield, datafield) values('yyyy','xxxx')");
pstmt.executeUpdate(); //<------- exception here
pstmt.close();
pstmt = null;
}
Sometimes we got the SQLIntegrityConstraintViolationException.
We couldn't figure out why this exception would happen.
Any advice would be greatly appreciated.
JC