用ibatis出现出错误请教com.ibatis.common.jdbc.exception.NestedSQLException:

com.ibatis.common.jdbc.exception.NestedSQLException:---Theerroroccurredincom/ibeats/P... com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/ibeats/Person.xml.
--- The error occurred while applying a parameter map.
--- Check the person1.getPerson-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 '??' at line 1
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:122)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:98)
at com.ibeats.PersonDaoImpl.findPersons(PersonDaoImpl.java:43)
at com.ibeats.PersonDaoImpl.main(PersonDaoImpl.java:54)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 '??' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:185)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
... 8 more
Exception in thread "main" java.lang.NullPointerException
at com.ibeats.PersonDaoImpl.main(PersonDaoImpl.java:54)
展开
 我来答
晨光0703
推荐于2017-11-25 · 沉淀能力,积累经验,涅槃重生
晨光0703
采纳数:68 获赞数:1336

向TA提问 私信TA
展开全部

你好:

  1. 首先,在ibatis的sql语句中尽量不要使用 * ,用多少,取多少,这样既能提升执行速度,也不容易出错。

  2. 这句报错明显是SQL语句出错了,暂时怀疑是你的SQL语句后面或者前面有不可见字符造成,可以检查下。

  3. 可以善用日志来帮忙打出SQL语句进行DEBUG。


希望帮到你。

本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
帐号已注销
2013-08-09 · TA获得超过122个赞
知道答主
回答量:106
采纳率:0%
帮助的人:83.4万
展开全部
ou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??' at line 1

你的sql语句写错了,如果自己查不出来哪里错了就把sql那部分前后的代码贴出来
追问
sql语句很简单select * from person查所有数据啊!

select * from person
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式