NutzCN Logo
问答 执行alter 出现的错误
发布于 3211天前 作者 Rekoe 1695 次浏览 复制 上一个帖子 下一个帖子
标签:

RT

ALTER TABLE sg_plot_config ADD COLUMN dt MediumBlob
2016-03-08 15:50:06,100 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - ALTER table sg_plot_config DROP column conf
2016-03-08 15:50:06,460 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - Create UNIQUE Index index_uid_plot_conf ON sg_plot_config(uid,dt)
2016-03-08 15:50:06,474 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SQLException
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: BLOB/TEXT column 'dt' used in key specification without a key length
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
	at com.mysql.jdbc.Util.getInstance(Util.java:387)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:939)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2547)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2505)
	at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:840)
	at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:740)
	at com.alibaba.druid.filter.FilterChainImpl.statement_execute(FilterChainImpl.java:2489)
	at com.alibaba.druid.filter.FilterAdapter.statement_execute(FilterAdapter.java:2451)
	at com.alibaba.druid.filter.FilterEventAdapter.statement_execute(FilterEventAdapter.java:188)
	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.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 org.nutz.dao.util.Daos.migration(Daos.java:832)
	at org.nutz.dao.util.Daos.migration(Daos.java:684)
	at com.shanggame.proxy.database.DBProxy.createTable(DBProxy.java:75)
	at com.shanggame.db.service.impl.PlotConfigService.create(PlotConfigService.java:41)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.nutz.ioc.trigger.MethodEventTrigger.trigger(MethodEventTrigger.java:18)
	at org.nutz.ioc.weaver.DefaultWeaver.onCreate(DefaultWeaver.java:72)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:204)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:27)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:31)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:204)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:229)
	at com.shanggame.msg.MessageHandler.getIHandler(MessageHandler.java:97)
	at com.shanggame.msg.MessageHandler.init(MessageHandler.java:73)
	at com.shanggame.AppSetup.init(AppSetup.java:51)
	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 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(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
2016-03-08 15:50:06,480 [ERROR][com.shanggame.AppSetup] - !Nutz SQL Error: 'Create UNIQUE Index index_uid_plot_conf ON sg_plot_config(uid,dt)'
PreparedStatement: 
'Create UNIQUE Index index_uid_plot_conf ON sg_plot_config(uid,dt)'
CaseMessage=BLOB/TEXT column 'dt' used in key specification without a key length FAIL to create Ioc Bean name=[plotConfigService] FAIL to create Ioc Bean name=[plotConfigHandler]
org.nutz.ioc.IocException: !Nutz SQL Error: 'Create UNIQUE Index index_uid_plot_conf ON sg_plot_config(uid,dt)'
PreparedStatement: 
'Create UNIQUE Index index_uid_plot_conf ON sg_plot_config(uid,dt)'
CaseMessage=BLOB/TEXT column 'dt' used in key specification without a key length FAIL to create Ioc Bean name=[plotConfigService] FAIL to create Ioc Bean name=[plotConfigHandler]
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:147)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:204)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:229)
	at com.shanggame.msg.MessageHandler.getIHandler(MessageHandler.java:97)
	at com.shanggame.msg.MessageHandler.init(MessageHandler.java:73)
	at com.shanggame.AppSetup.init(AppSetup.java:51)
	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 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(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.nutz.ioc.IocException: !Nutz SQL Error: 'Create UNIQUE Index index_uid_plot_conf ON sg_plot_config(uid,dt)'
PreparedStatement: 
'Create UNIQUE Index index_uid_plot_conf ON sg_plot_config(uid,dt)'
CaseMessage=BLOB/TEXT column 'dt' used in key specification without a key length FAIL to create Ioc Bean name=[plotConfigService]
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:147)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:204)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:27)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:31)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135)
	... 23 more
Caused by: org.nutz.dao.DaoException: !Nutz SQL Error: 'Create UNIQUE Index index_uid_plot_conf ON sg_plot_config(uid,dt)'
PreparedStatement: 
'Create UNIQUE Index index_uid_plot_conf ON sg_plot_config(uid,dt)'
CaseMessage=BLOB/TEXT column 'dt' used in key specification without a key length
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:94)
	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 org.nutz.dao.util.Daos.migration(Daos.java:832)
	at org.nutz.dao.util.Daos.migration(Daos.java:684)
	at com.shanggame.proxy.database.DBProxy.createTable(DBProxy.java:75)
	at com.shanggame.db.service.impl.PlotConfigService.create(PlotConfigService.java:41)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.nutz.ioc.trigger.MethodEventTrigger.trigger(MethodEventTrigger.java:18)
	at org.nutz.ioc.weaver.DefaultWeaver.onCreate(DefaultWeaver.java:72)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138)
	... 28 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: BLOB/TEXT column 'dt' used in key specification without a key length
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
	at com.mysql.jdbc.Util.getInstance(Util.java:387)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:939)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2547)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2505)
	at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:840)
	at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:740)
	at com.alibaba.druid.filter.FilterChainImpl.statement_execute(FilterChainImpl.java:2489)
	at com.alibaba.druid.filter.FilterAdapter.statement_execute(FilterAdapter.java:2451)
	at com.alibaba.druid.filter.FilterEventAdapter.statement_execute(FilterEventAdapter.java:188)
	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)
	... 44 more
2016-03-08 15:50:06,511 [INFO][org.nutz.mvc.impl.NutLoading] - Nutz.Mvc[nutz] is up in 6256ms
1 回复

OK
问题是拿这个类型来做 索引了

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