QueryRunner runner = new QueryRunner(); User u = runner.query(conn, "SELECT * FROM tb_user WHERE id=?", new BeanHandler<User>(User.class){ @Override public User handle(ResultSet rs) throws SQLException { BeanHandler<User> handler = new BeanHandler<User>(User.class); return null; } },1);
这段话为什么报错?
Exception in thread "main" java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=1' at line 1 Query: SELECT * FROM tb_user WHERE id=? Parameters: [1] at org.apache.commons.dbutils.AbstractQueryRunner.rethrow(AbstractQueryRunner.java:363) at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:350) at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:211) at cn.mhtml.ide.controller.IDEController.main(IDEController.java:137)说事SQL语法错误。。。费解啊
where后面那个空格打成中文的全角空格了...呃~,果然如是<imgsrc="http://www.oschina.net/js/ke/plugins/emoticons/images/34.gif"alt=""/>
1.类型不匹配?
2.为什么返回null?
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。