Re: jdbc question

From: Ann (Ann_at_nospam.invalid)
Date: 12/30/04


Date: Thu, 30 Dec 2004 03:11:09 GMT


"jmt" <ejbengine@yahoo.com> wrote in message
news:cqud3s$i58$1@ctb-nnrp2.saix.net...
> Using JDBC , what would be a more elegant way of determining whether or
> not a record already exists in a DB table before inserting it?
>
> Jeff
> Registered Linux user number 366042

Why do you want to know? Let me suggest that you don't.
What would you do if you found out that the record existed
already? My guess is that you would not insert it. And if
the record did not exist? Then you would insert it. The
result is the same, the record exists when you are done.
So just do the insert and ignore the error. Of course it
is perfectly legal for two rows in the same table to
contain the same values, so if you only want one row,
you would need to set that in the database itself.



Relevant Pages

  • jdbc question
    ... Using JDBC, what would be a more elegant way of determining whether or ... not a record already exists in a DB table before inserting it? ... Jeff ...
    (comp.lang.java.programmer)
  • Re: jdbc question
    ... > Using JDBC, what would be a more elegant way of determining whether or ... > not a record already exists in a DB table before inserting it? ... An elegant solution can be sought from http://www.hibernate.org/ ... Tony Morris ...
    (comp.lang.java.programmer)
  • Re: How to insert a page in a book that has linked text boxes.
    ... Publisher experts out there: isn't there a simple and elegant solution ... inserting a new page in a sequentially paged document? ...
    (microsoft.public.publisher)
  • Re: jdbc question
    ... jmt wrote: ... > Using JDBC, what would be a more elegant way of determining whether or ... Curiosity *Skilled* the cat ...
    (comp.lang.java.programmer)
  • Re: few rows of aligned expressions with only one reference number?
    ... Inserting \nonumber does job and satisfy my needs, ... elegant way to solution like this one. ... Apartmani na Kupresu: http://www.geocities.com/kupres100/stipe.html ...
    (comp.text.tex)