简体   繁体   中英

Login for java not authenticating access for mysql database

我已经设置了一个gui,该gui具有一个登录界面和一个存储用户名和密码的数据库,但是当我尝试在gui上登录时,即使我输入了数据库中的确切数据,它也给了我无效的登录信息。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM