• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

perfect match in database

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
have a good day...................

now i have a one table name "usertable" having a column like this
(1)user (2)password.

i want to perfect match of password.
suppose table have a "AbcD" password.

in simple query ,
"select * from usertable where password="abcd";"
this query returns data. but this query should not be return data.
because in database password="AbcD".

so what query i write to do exact match ?

thanks,
Nimish Patel
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nimish,
Whether or not the "=" operator is case sensitive is database specific. I think Oracle does not use case sensitivity here which is in line with what you are seeing. I can think of three things to try:
1) retrieve the password and compare in java
select password from usertable where username = 'user'
2) use the like operator - sometimes like is more strict
select * from usertable where password like "abcd"
3) use a PreparedStatement - the driver may give you case insensitivity
select * from usertable where password like ?

Personally, I prefer option one because it is less dependent on the database. It's also the only one I am positive will work.
 
Nimish Patel
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Jeanne,
Thanks a lot for giving your valuable time.

have a good day.

Thank u once again.

bye bye.

regards,
nimish
 
I don't even know how to spell CIA. But this tiny ad does:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic