数据库没有被选中
加上数据库名.表名后
@Override
public int queryCount(String username, String password) {
String sql = "select count(1) from qf_p2_community_ms.admins where `username`=? and `password`=?";
Object[] args = {username, password};
Number count = (Number) queryForSingleValue(sql, args);
return count.intValue();
}
由此可知,写properties时,连接没有写好,很有可能是数据库名那写的有问题。 连接数据库名正确写法
url=jdbc:mysql://localhost:3306/qf_p2_community_ms?useUnicode=true&characterEncoding=utf-8&useSSL=true
去掉数据库.
String sql = "select count(1) from admins where `username`=? and `password`=?";
运行成功
|