MySQL Forums
Forum List  »  Knowledge Base

Primary Key duplication on insert
Posted by: John Pearcey
Date: July 22, 2008 09:13AM

I have a database table with 9 columns, the first field is the primary key and is the only index on the table. It is set to auto_increment. I have been using the JDBC from Java to insert records into this table for about 6 months and there have been no problems until last night. I have just over 850000 rows in the table and the JDBC failed to insert a record complaining of a duplicate key. I do not specify the key since it is auto_increment and I let the database handle it so I was a bit perplexed as to where the problem might be. My quick and dirty solution was to make a copy of the table using mysqldump and then truncate it. Inserts are now working correctly.

I'm obviously going to need to do a lot more work to track this down so I thought I'd ask whether anyone else has experienced a problem like this first.

Options: ReplyQuote


Subject
Views
Written By
Posted
Primary Key duplication on insert
4022
July 22, 2008 09:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.