jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes java.sql.SQLException: Invalid argument value: Duplicate entry '3' for key 1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

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

Satyajeet Kadam
Ranch Hand

Joined: Oct 19, 2006
Posts: 215
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
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

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.


My Blog: Down Home Country Coding with Scott Selikoff
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30370
    
150

Please continue conversation in your other thread.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
Consider Paul's rocket mass heater.
 
subject: java.sql.SQLException: Invalid argument value: Duplicate entry '3' for key 1