jQuery in Action, 3rd edition
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Duplicate Key Exception" Watch "Duplicate Key Exception" New topic

Duplicate Key Exception

ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76

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.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

Moved to Java in General (beginner)

[Asking smart questions] [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).


Java API Documentation
The Java Tutorial
I agree. Here's the link: http://aspose.com/file-tools
subject: Duplicate Key Exception
It's not a secret anymore!