Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
    Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException: Invalid argument value: Duplicate entry '3' for key 1

 
Satyajeet Kadam
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi, i am getting following error
I am using mysql database


<code>
java.sql.SQLException: Invalid argument value: Duplicate entry '3' for key 1
</code>







ts_user CREATE TABLE `ts_user` (
`user_id` int(11) NOT NULL auto_increment,
`ref_company_id` int(11) default NULL,
`email` varchar(50) default NULL,
`password` varchar(10) default NULL,
`name` varchar(25) default NULL,
PRIMARY KEY (`user_id`),
KEY `ref_company_id` (`ref_company_id`),
FOREIGN KEY (`ref_company_id`) REFERENCES `ts_company` (`company_id`)
) TYPE=InnoDB


[/CODE]
 
Scott Selikoff
author
Saloon Keeper
Posts: 4020
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not duplicate post.

To answer your question for both posts as previously stated, DO NOT USE COUNT(*) FOR AUTO_INCREMENT, your record count is out of sync with your data.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please continue conversation in your other thread.
 
    Bookmark Topic Watch Topic
  • New Topic