File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC 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
Bookmark "forum regarding insert data" Watch "forum regarding insert data" New topic
Author

forum regarding insert data

surya nara
Greenhorn

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
Bartender

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: http://aspose.com/file-tools
 
subject: forum regarding insert data
 
Similar Threads
JDBC / SqlServer / MSDriver / executeBatch / no exception thrown
Exception while trying to add a new user to the database
Insert Query with auto-incrementing key
hi urgent
ResultSet is not updateable.