JDBC 封装连接是好的前提: SystemAuthorizingRealm c = new SystemAuthorizingRealm(); conn = c.getConnection(); // conn = ((DataSource) SpringContextUtil.getBean("dataSource")).getConnection(); PreparedStatement ps = conn.prepareStatement(sql); ps.setString(i1, token.getUsername().trim()); ps.setString(i2, Encrypt.getMD5(String.valueOf(token.getPassword())).trim()); System.out.println(Encrypt.getMD5(String.valueOf(token.getPassword()))); //运行到这里时。我把sql和相关參数放到工具里查询时能查询到数据; ResultSet rs = ps.executeQuery(); //这里确打印的是false,按理说有数据应该是true才对吧? System.out.println(rs.next()); 那位知道的帮忙指导一下吧?