Solved

SQLException - unique values

Posted on 2007-11-19
5
776 Views
Last Modified: 2012-06-27
i am getting the following exception for my SQL statement

java.sql.SQLException: Violation of unique constraint $$: duplicate value(s) for column(s) $$: SYS_PK_52

create table statement shown below:

what sql syntax lets me allow to store duplicate values?? .. thou i'm sure of not having duplicate values for my columns.. but for large dataset, it throws the exception

thanks


DBTableFunctions.createTableFromString("CREATE CACHED TABLE "+tableName+" ("+"ImageID VARCHAR(256) PRIMARY KEY, "+colNames+") CREATE UNIQUE INDEX IMAGEID_INDEX ON "+tableName+"(ImageID)");

Open in new window

0
Comment
Question by:max_dub
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 250 total points
ID: 20317188
Take out UNIQUE
DBTableFunctions.createTableFromString("CREATE CACHED TABLE "+tableName+" ("+"ImageID VARCHAR(256) PRIMARY KEY, "+colNames+") CREATE INDEX IMAGEID_INDEX ON "+tableName+"(ImageID)");

Open in new window

0
 
LVL 23

Expert Comment

by:cmalakar
ID: 20317772
Remove the PRIMARY KEY on the column..
 
Primary key make sures the column, contains values which are not null and not duplicated.
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20318504
is the sqlexception being thrown in createTableFromString? or are you just showing the table create code, whereas the failing code is elsewhere?
0
 

Author Comment

by:max_dub
ID: 20319053
i thought the exception was occuring due to unique index being create during createtable statement, hence i showed the create table statement

it cud be somewhere else also.. but i am sure.. where can it be getting duplicate values.. i double checked all my rows have unique filename, rest of 100 col. have floating point values..

i am debugging it right now!

thou i did remove the remove the Create Unique Index from create table statement

0
 

Author Comment

by:max_dub
ID: 20321795
with just primary key it works fine - no errors whole day
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
The viewer will learn how to implement Singleton Design Pattern in Java.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question