Web_Admin
asked on
Duplicate Records JDBC
Hello experts,
I want to know what the cause of inserting duplicate records where it should insert one record only in JDBC? my primary key is auto increment and how can i avoid this
I want to know what the cause of inserting duplicate records where it should insert one record only in JDBC? my primary key is auto increment and how can i avoid this
ASKER
Hi,
1) my DB is oracle 10g
2) Numeric auto increment
3) no
Thanx
1) my DB is oracle 10g
2) Numeric auto increment
3) no
Thanx
Can you post the result of this query?
SELECT table_name, index_name, column_name FROM dba_ind_columns WHERE table_name = 'yourtable';
ASKER
actually it inserts same record twice with different primary key where it should be insertted once
ASKER
its more like the method on record insert executed twice
>>actually it inserts same record twice with different primary key where it should be insertted once
That's a different record then. Sounds like the error is in your application, not the db
That's a different record then. Sounds like the error is in your application, not the db
ASKER
CEHJ:
Yes i know so that I post the questuion in java zone
Yes i know so that I post the questuion in java zone
Yes, but you've only talked about the table definition and posted no application code. It's an app problem
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No application info provided by the asker
wouldn't this come under "If you are not getting the kinds of responses that will lead to a solution, you should consider deleting your question and trying again."
Web_Admin,
Add some logging to the code that does the insert to get an idea when it is getting executed
perhaps also a stack trace so you know where it is being called from
http://helpdesk.objects.com.au/java/how-to-store-exception-stack-trace-as-string
Add some logging to the code that does the insert to get an idea when it is getting executed
perhaps also a stack trace so you know where it is being called from
http://helpdesk.objects.com.au/java/how-to-store-exception-stack-trace-as-string
1) What DB you are using ?
2) What is the type of your Primary Key
3) Do you have any UNIQUE index on the table ?