{{theTime}}

Search This Blog

Total Pageviews

java.sql.SQLException: The INSERT statement conflicted with the FOREIGN KEY constraint "XXXXXFK1"

java.sql.SQLException: The INSERT statement conflicted with the FOREIGN KEY constraint "XXXXXFK1"
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671)
at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:613)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:572)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.execute(JtdsPreparedStatement.java:784)

Resolution:   

Check the foreign key constraint and first insert the required record.  If all records are inserted as part of current database transaction, make sure the sequence of inserts are handled correctly and also verify transaction commit levels.

No comments:

Best Client Optimized Programming Language for Mobile Development?

Use Google's Dart language, which is Object-oriented, class-based and garbage-collected language with C-Style.  Dart can compile to eith...