• 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

verify database use_id and password

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to write a very simple GUI asking user to input his/her database uid and pwd. If the login is accepted or rejected, they will see the corresponding pages. Just wondering how to check if the uid/pwd for database is correct ? just try to build a database Connection using the GUI's input uid/pwd ? and if there is no SQLException then it is ok, or it fails ? But it seems SQLException can be caused by other database problem other than incorrect uid/pwd... How to exactly check if the uid/pwd is correct ?

thanks.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will have to parse the exception I'm afraid. Each DB returns a consistant error message for an authentication failure, and SQLExceptions just repeat the content of that error. So for each DB you use this with you will need to watch out for the appropriate error message.
 
reply
    Bookmark Topic Watch Topic
  • New Topic