It's not a secret anymore!
The moose likes JDBC and the fly likes forum regarding insert data Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: forum regarding insert data
 
Similar Threads
hi urgent
JDBC / SqlServer / MSDriver / executeBatch / no exception thrown
Exception while trying to add a new user to the database
Insert Query with auto-incrementing key
ResultSet is not updateable.