java.sql.SQLException: ORA-00001:

when am creating db table and inserting records my servlet is working well but when I am importing my db data and then inserting record, the following error appears. I am 100% sure there is no duplicate record

java.sql.SQLException: ORA-00001: unique constraint (dbName.SYS_C005755) violated

thanks & best regards

[337 byte] By [farakha] at [2007-11-27 8:00:40]
# 1

The unique constraint is probably not on the entire record, but only on one or two columns. Look at the constraint and make sure you know what column(s) it is on. Check the data model or I think you can do it with this SQL:

select ic.column_name

from user_constraints c, user_indexes i, user_ind_columns ic

where i.index_name = c.index_name

and ic.index_name = i.index_name

and c.constraint_name = 'SYS_C005755'

Next, to track down what's going on, catch the SQLException and print out the row you were trying to insert (and maybe the line number from your import file). Look at the offending column to get the duplicate value. Now search your input file for that value, probably you'll find it duplicated somewhere. If you want to be fancy, you should catch the exception and probably log the duplicate value. That way if it comes up e.g. in production you can always go to the logs and quickly see what the problem record is.

Jemiah

fishninja007a at 2007-7-12 19:42:41 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
thanks a lotthanks again
farakha at 2007-7-12 19:42:41 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...