Two Laptop Bag
The moose likes JDBC and Relational Databases and the fly likes GUI to verify database login/pwd Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "GUI to verify database login/pwd" Watch "GUI to verify database login/pwd" New topic

GUI to verify database login/pwd

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 ?

Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1138

You need to check the error code of the "SQLException" to see the exact nature of the exception. I suggest code similar to the following:
[NOTE: Uncompiled and untested.]

Good Luck,
I agree. Here's the link:
subject: GUI to verify database login/pwd
jQuery in Action, 3rd edition