NutzCN Logo
问答 sql 文件执行 错误
发布于 3190天前 作者 Rekoe 4769 次浏览 复制 上一个帖子 下一个帖子
标签:

执行这样的sql

/* system_user */
alter table pj_usr_auth add constraint FK_Reference_8 foreign key (usr) references usr (usr) on delete restrict on update restrict;

错误

2016-03-29 21:04:42,407 [DEBUG][org.nutz.dao.impl.FileSqlManager] - load >> init_system_h2.sql from root=init_system_h2.sql
2016-03-29 21:04:42,407 [DEBUG][org.nutz.dao.impl.FileSqlManager] - key=[system_user], sql=[alter table pj_usr_auth add constraint FK_Reference_8 foreign key (usr) references usr (usr) on delete restrict on update restrict;]
2016-03-29 21:04:42,407 [DEBUG][org.nutz.dao.impl.FileSqlManager] - load 1 sql >> init_system_h2.sql from root=init_system_h2.sql
2016-03-29 21:04:42,423 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - alter table pj_usr_auth add constraint FK_Reference_8 foreign key (usr) references usr (usr) on delete restrict on update restrict;
2016-03-29 21:04:42,423 [ERROR][com.alibaba.druid.filter.stat.StatFilter] - merge sql error, dbType mysql, sql : 
alter table pj_usr_auth add constraint FK_Reference_8 foreign key (usr) references usr (usr) on delete restrict on update restrict;
com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'rict on update restrict;',expect ON, actual ON on
	at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:231)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:407)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:145)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:140)
	at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:53)
	at com.alibaba.druid.filter.stat.StatFilter.mergeSql(StatFilter.java:145)
	at com.alibaba.druid.filter.stat.StatFilter.createSqlStat(StatFilter.java:630)
	at com.alibaba.druid.filter.stat.StatFilter.internalBeforeStatementExecute(StatFilter.java:397)
	at com.alibaba.druid.filter.stat.StatFilter.statementExecuteBefore(StatFilter.java:345)
	at com.alibaba.druid.filter.FilterEventAdapter.statement_execute(FilterEventAdapter.java:185)
	at com.alibaba.druid.filter.FilterChainImpl.statement_execute(FilterChainImpl.java:2487)
	at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.execute(StatementProxyImpl.java:137)
	at com.alibaba.druid.pool.DruidPooledStatement.execute(DruidPooledStatement.java:421)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runStatement(NutDaoExecutor.java:321)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:52)
	at org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:105)
	at org.nutz.dao.impl.DaoSupport$DaoExec.invoke(DaoSupport.java:316)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:59)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:239)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:271)
	at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:235)
	at com.rekoe.MvcSetup.init(MvcSetup.java:79)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:276)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:120)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	at com.rekoe.mvc.RkCmsNutFilter.init(RkCmsNutFilter.java:22)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
2016-03-29 21:04:42,669 [ERROR][com.alibaba.druid.pool.DruidDataSource] - discard connection
3 回复
com.alibaba.druid.filter.stat.StatFilter

基本上这个类提示的错误都不是真正错误. 日志级别里面把这个类设置为OFF即可

@wendal
但 sql 貌似执行是失败的
不过 这个应该是druid的问题 已经提交isuess给druid作者了

@Rekoe 哦,我还以为只是提示一下

添加回复
请先登陆
回到顶部