aspose file tools*
The moose likes JDBC and the fly likes Re: Checking for duplicate rows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Re: Checking for duplicate rows" Watch "Re: Checking for duplicate rows" New topic
Author

Re: Checking for duplicate rows

Ashwin Tadepalli
Greenhorn

Joined: Feb 01, 2001
Posts: 27
Hi,
What is the easiest way to check for the insertion of duplicate rows in a database table from a client program.I have tried used using try catch block statements and then raising an exception,but it does not solve my problem.All of my JDBC processing is done through a servlet,so if I try to run the client program and try to insert some duplicate entries it stops my servlet engine.I can see that it has raised that SQL exception on the console of my Visual Age tool,but I want some other method which will not let my servlet engine to stop but tell in advance to the client program(on the command prompt) that you are trying to insert some duplicate entries.Any suggestions on this topic are welcome.
Thanking You
Ashwin
Monty Ireland
Ranch Hand

Joined: Oct 03, 2000
Posts: 161
Use the kiss() method...
exec a select using the table's primary key...
if you get a row count GT 0..
then you have a duplicate...

------------------
Multi-Platform Database Developer


Multi Platform Database Developer & DBA on E.S.T.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Re: Checking for duplicate rows