Link to home
Start Free TrialLog in
Avatar of Web_Admin
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
Avatar of elimesika
elimesika
Flag of Israel image

HI

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 ?
Avatar of Web_Admin
Web_Admin

ASKER

Hi,

1) my DB is oracle 10g
2) Numeric auto increment
3) no

Thanx
Avatar of CEHJ
Can you post the result of this query?
SELECT table_name, index_name, column_name FROM dba_ind_columns WHERE table_name = 'yourtable';

Open in new window

actually it inserts same record twice with different primary key where it should be insertted once
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
CEHJ:
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
Avatar of msk_apk
msk_apk
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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