0

I've set up a gui that has a login interface and a database which stores usersnames and passwords, but when im trying to login on the gui its giving me invalid login even when i put in the exact data from my database.

6
  • please check manually mysql username/password. Commented Oct 4, 2013 at 13:01
  • I mean to check mysql username/password is correct ? Commented Oct 4, 2013 at 13:08
  • resultset return some data or empty data ? Commented Oct 4, 2013 at 13:20
  • @HarmeetSingh I'm not sure how do you tell? Commented Oct 4, 2013 at 13:35
  • if resultset return username/password, check the letters cases, because equals("string") is case sensitive function. Commented Oct 4, 2013 at 13:55

1 Answer 1

1

Change your Sql Statement as

select userName,password from person where userName = ? and password = ? 

instead of

   select userName from person where userName = ? and password = ?

UPDATE

Infact you no need to check again username and password in java code, your query itself will tells you he/she is valid or not

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.