frank_hero 2016-06-10 03:20 采纳率: 33.3%
浏览 2674

关于mybatis的sqlxml文件中mysql分页问题

当LIMIT #{startNumber},#{showNumber}这样写时会报错。
换成LIMIT 0,10 就不会报错了。什么原因?jdbc驱动jar也换了还是报错。求解。

 Database product name cached for DataSource [org.apache.commons.dbcp.BasicDataSource@142bec44]: name is 'MySQL'
[org.springframework.jdbc.support.SQLErrorCodesFactory] - SQL error codes for 'MySQL' found
[org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator] - Translating SQLException with SQL state '42000', error code '1064', message [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','15'' at line 4]; SQL was [] for task [
### 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 ''1','15'' at line 4
### The error may exist in file [D:\develop\java\tomcat\webapps\adream\WEB-INF\classes\com\dream\mapping\fixedassets\CommoditySQL.xml]
### The error may involve com.dream.fixedassets.dao.CommodityDao.commodityList-Inline
### The error occurred while setting parameters
### SQL: select * from l_commodity               order BY  p_number     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 ''1','15'' at line 4
]
六月 10, 2016 11:11:14 上午 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [SpringMVC] in context with path [/adream] threw exception [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 ''1','15'' at line 4
### The error may exist in file [D:\develop\java\tomcat\webapps\adream\WEB-INF\classes\com\dream\mapping\fixedassets\CommoditySQL.xml]
### The error may involve com.dream.fixedassets.dao.CommodityDao.commodityList-Inline
### The error occurred while setting parameters
### SQL: select * from l_commodity               order BY  p_number     LIMIT  ?,?
  • 写回答

2条回答

  • JPF1024 2016-06-10 05:27
    关注

    推荐你配合Spring使用,Spring提供了分页的类,已经做好了。

    如果要自己实现,可以参考:http://blog.csdn.net/isea533/article/details/23831273

    评论

报告相同问题?

悬赏问题

  • ¥20 simulink中怎么使用solve函数?
  • ¥30 dspbuilder中使用signalcompiler时报错Error during compilation: Fitter failed,求解决办法
  • ¥15 gwas 分析-数据质控之过滤稀有突变中出现的问题
  • ¥15 没有注册类 (异常来自 HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
  • ¥15 知识蒸馏实战博客问题
  • ¥15 用PLC设计纸袋糊底机送料系统
  • ¥15 simulink仿真中dtc控制永磁同步电机如何控制开关频率
  • ¥15 用C语言输入方程怎么
  • ¥15 网站显示不安全连接问题
  • ¥15 51单片机显示器问题