aspose file tools
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
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: 202
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: 3652

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: 26182
    
  66

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
 
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: java.sql.SQLException: Invalid argument value: Duplicate entry '3' for key 1
 
Similar Threads
Hibernate is driving me crazy !
NullPointerException
struts form beans
hibernate hello world
Implementing auto increment programitcally