aspose file tools
The moose likes Beginning Java and the fly likes Duplicate Key Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Duplicate Key Exception" Watch "Duplicate Key Exception" New topic
Author

Duplicate Key Exception

ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76
Hi,

I have a column which is Unique, when I try to enter duplicate values, it gives me duplicate key exception. How to catch this exception.

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 62291
    
  68

Moved to Java in General (beginner)


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Can you please elaborate? Where are you storing this unique "column"? Where are you "entering" it? What code causes the exception?

In general, you use a try...catch() clause to catch an exception:

I suggest you find a beginning Java text. Any text worth its salt will have at least an introduction to exception handling that will provide more details than I have given here. Alternatively, you chould check out the exception handling section in the Java Tutorial (see the link in my sig).

Layne


Java API Documentation
The Java Tutorial
 
Consider Paul's rocket mass heater.
 
subject: Duplicate Key Exception