File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes forum regarding insert data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "forum regarding insert data" Watch "forum regarding insert data" New topic

forum regarding insert data

surya nara

Joined: Sep 14, 2007
Posts: 1
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The INSERT statement conflicted with the FOREIGN KEY constraint "FK_EmpDetails_Emp". The conflict occurred in database "itracker", table "dbo.Emp", column 'EmpId'.

how can i handle this exception
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Make sure the data you insert doesn't conflict with your database constraints. My guess is you are inserting a record into the emp table that uses an empId that does not exist in empdetails?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: forum regarding insert data
It's not a secret anymore!