File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Continue with HashMap iterator even if SQLException is caught Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Continue with HashMap iterator even if SQLException is caught" Watch "Continue with HashMap iterator even if SQLException is caught" New topic
Author

Continue with HashMap iterator even if SQLException is caught

Manju Krishna
Ranch Hand

Joined: Apr 09, 2009
Posts: 48
    
    1
Hi,

I need to populate a table in the database based on the values in hashmap.
The hashMap may contain deuplicate values in it but with different key..
the code snippet is...




When i insert into the DB... the duplicate values must not go in as i have a unique index on the values...
so what ever it takes from hashmap.. it should insert wat is not already der.. so i added a catch block to just log that the entry already exists...
so wat i need is to continue with the next iterator after the exception is caught..
This seemed to be working at times.. but not all times.. Can anyone help me out this... Its a long time show stopper in the project..
please help...

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14669
    
  11

Why don't you just put pstmtLGGLS.execute(); in a try/catch block ?


[My Blog]
All roads lead to JavaRanch
Manju Krishna
Ranch Hand

Joined: Apr 09, 2009
Posts: 48
    
    1
Yes.. it works.. thanks for the help..
and also sorry for posting it twice as i was not sure of where to post..

Thanks a lot..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Continue with HashMap iterator even if SQLException is caught
 
Similar Threads
PreparedStatement: Performance bottleneck in using new String(...) in setString meth
Odd problem with JdbcOdbc
Retry Failed Insert Attempt?
Continue with HashMap iterator even if SQLException is caught
oracle connection with jdbc