Duplicate key or integrity constraint violation - Mysql
From: FreudianSlip (waynemarrison_at_yahoo.co.uk)
Date: 06/17/04
- Previous message: Hamed Seifoddini: "Re: HELP !!! java.sql.SQLException: General error HELP!!!!!"
- Next in thread: Colin 't Hart: "Re: Duplicate key or integrity constraint violation - Mysql"
- Reply: Colin 't Hart: "Re: Duplicate key or integrity constraint violation - Mysql"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 17 Jun 2004 02:50:05 -0700
Hi all,
I have recently started programming in Java, so forgive me if theres
something very basic about the problem i'm having.
I have MySQL 4.0.15 running on linux box quite happily and am using
Java 1.4.2 and Netbeans 3.6 to access and update the database.
One table has an autoincrement field (counter) and i get the following
message when I try to insert a record in the table.
Duplicate key or integrity constraint violation, message from
server: "Duplicate entry 'null' for key 1"
I have tried various ways to perform the insert, using:
String SQL = "insert into Header values (NULL,'" + getClusterID() +
"','" .....
and
String SQL = "insert into Header values (0, '" + getClusterID() +
"','" .....
along with:
String SQL = "insert into Header (ClusterID,TStamp ...etc ) values
(getClusterID() + "','" .....
But still I get the error.
If I check the table after the program fails, the record has been
successfully inserted with the correct auto increment figure, however
of course the program stops dead at that point and does not continue.
Any help would be much appreciated.
Thanks
W
- Previous message: Hamed Seifoddini: "Re: HELP !!! java.sql.SQLException: General error HELP!!!!!"
- Next in thread: Colin 't Hart: "Re: Duplicate key or integrity constraint violation - Mysql"
- Reply: Colin 't Hart: "Re: Duplicate key or integrity constraint violation - Mysql"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|