This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes verify database use_id and password Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "verify database use_id and password" Watch "verify database use_id and password" New topic
Author

verify database use_id and password

Artemesia Lakener
Ranch Hand

Joined: Jun 21, 2005
Posts: 162
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.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
 
subject: verify database use_id and password
 
Similar Threads
GUI to verify database login/pwd
split function problem in AWK
How to update a database using web forms
Connection reset by peer:JVM_recv in socket input stream read
error in finally