• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

how to check the existance of a record stored in a database

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
i have stored the cities' names in the database so that i can use these records in extracting cities from any given document.
what's the best way to do so?

1- The simplest way is to get each single record(city name) and check whether it exists in the document or not, but this will take a lot of time (looping through all the records, knowing that we have about 2000 city)

2- I thought of using regular expressions by placing all the cities in one regular expression like this (Anguilla|Vienna|Aberdeen|Boston|Egypt|Columbia....etc)
but as we said before it ll be too long regular expression that will take long time too

can anyone tell me what to do, what's the best solution in such cases
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This post has nothing to do with SCJP.

You might post it again at JDBC Forum.

Nick
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
nadine ...

By the way, your name violates the Naming Policy, please change it at Your Profile.

Nick
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic