mybatis一直报语法异常

mybatis一直报语法错误
本帖最后由 zhuyc 于 2014-12-31 10:46:24 编辑
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException
### Error querying database.  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 ''0','25'' at line 4
### The error may exist in file [D:\tomcat7\webapps\ROOT\WEB-INF\classes\sql-mapper\puterMapper.xml]
### The error may involve com.puter.dao.puterDAO.findPuter-Inline
### The error occurred while setting parameters
### SQL: select * from tbl_puter               limit ?,?
### 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 ''0','25'' at line 4
; bad SQL grammar []; nested exception is 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 ''0','25'' at line 4
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

<select id="findPuter" parameterType="map" resultMap="puterResult">
select * from tbl_puter limit #{s},#{limit}
</select>

把sql单独拿到终端是能正确执行的呢。
------解决思路----------------------
后台接收的s应该出错了
------解决思路----------------------
看下接收的两个参数
------解决思路----------------------
the error occurred while setting parameters
select * from tbl_puter               limit ?,? 
limit 传入的参数错误,分页有问题啊。
------解决思路----------------------
log4jdbc3-1.2.1.jar 可以打印出带参数的sql
log4j.logger.jdbc.sqlonly=off 
log4j.logger.jdbc.sqltiming=on 
log4j.logger.jdbc.audit=off  
log4j.logger.jdbc.resultset=off 
log4j.logger.jdbc.connection=off


jdbc.driver=net.sf.log4jdbc.DriverSpy
jdbc.url=jdbc:log4jdbc:XXX


------解决思路----------------------
你传的参数是字符类型还是整数类型?

------解决思路----------------------
你在dao打印下limit的参数,应该是参数错了
------解决思路----------------------
传入分页的参数有问题