@JFinal 波总 用sql String sql = "show columns from ymm_"+tableName; List list =Db.query(sql); 报错,之前是可以用的,什么情况啊

yuzhibin 发布于 05/20 14:23
阅读 206
收藏 0

com.jfinal.plugin.activerecord.ActiveRecordException: io.shardingjdbc.core.parsing.parser.exception.SQLParsingUnsupportedException: Not supported token 'SHOW'.
    at com.jfinal.plugin.activerecord.DbPro.query(DbPro.java:109)
    at com.jfinal.plugin.activerecord.DbPro.query(DbPro.java:120)
    at com.jfinal.plugin.activerecord.Db.query(Db.java:85)
    at com.ymm.project.base.BaseModel.getModels(BaseModel.java:37)
    at com.ymm.project.controller.shoptype.ShopTypeController.toEdit(ShopTypeController.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.jfinal.aop.Invocation.invoke(Invocation.java:73)
    at com.ymm.project.base.LoginAjaxInterceptor.intercept(LoginAjaxInterceptor.java:11)
    at com.jfinal.aop.Invocation.invoke(Invocation.java:67)
    at com.jfinal.core.ActionHandler.handle(ActionHandler.java:78)
    at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: io.shardingjdbc.core.parsing.parser.exception.SQLParsingUnsupportedException: Not supported token 'SHOW'.
    at io.shardingjdbc.core.parsing.parser.sql.SQLParserFactory.newInstance(SQLParserFactory.java:57)
    at io.shardingjdbc.core.parsing.SQLParsingEngine.parse(SQLParsingEngine.java:50)
    at io.shardingjdbc.core.routing.router.ParsingSQLRouter.parse(ParsingSQLRouter.java:74)
    at io.shardingjdbc.core.routing.PreparedStatementRoutingEngine.route(PreparedStatementRoutingEngine.java:55)
    at io.shardingjdbc.core.jdbc.core.statement.ShardingPreparedStatement.route(ShardingPreparedStatement.java:150)
    at io.shardingjdbc.core.jdbc.core.statement.ShardingPreparedStatement.executeQuery(ShardingPreparedStatement.java:115)
    at com.jfinal.plugin.activerecord.DbPro.query(DbPro.java:80)
    at com.jfinal.plugin.activerecord.DbPro.query(DbPro.java:107)
    ... 32 more
 

加载中
1
红薯官方
红薯官方

这个错误跟 JFinal 没关系,而是你用了shardingjdbc,shardingjdbc 解析语法时不支持这个 SHOW 语句!

要学会怎么看异常调用链和责任方啊。

yuzhibin
yuzhibin
谢谢指点
0
前端大师傅
前端大师傅

异常信息很明显提示:SQLParsingUnsupportedException: Not supported token

即shardingjdbc 不支持show columns语法,建议换成select from information_schema. COLUMNS

yuzhibin
yuzhibin
谢谢
返回顶部
顶部