码迷,mamicode.com
首页 > 数据库 > 详细

MySQL server version for the right syntax to use near 'type=InnoDB' at line 1

时间:2014-10-17 10:49:54      阅读:238      评论:0      收藏:0      [点我收藏+]

标签:hibernate

           转载请注明出处:http://blog.csdn.net/bettarwang/article/details/40180271

       在运行一个Hibernate的示例时,配置了<property name="hibernate.hbm2ddl.auto">update</property>属性,但是自动建表却一直不成功,出错信息为:

        ERROR: HHH000388: Unsuccessful: create table info_table (id integer not null auto_increment, title varchar(255), content varchar(255), primary key (id)) type=InnoDB

        ERROR: 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 ‘type=InnoDB‘ at line 1

        很显然,这是MySQL的版本问题导致的,实际上,在MySQL5.0以前,type=InnoDB是有效的SQL语句,但是自己用的是MySQL5.5版本,type=InnoDB不再有效了。

       解决办法就是修改hibernate.cfg.xml中的dialect属性,将

  <property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>修改为

   <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>

      再次运行,发现可以自动建表了。









MySQL server version for the right syntax to use near 'type=InnoDB' at line 1

标签:hibernate

原文地址:http://blog.csdn.net/bettarwang/article/details/40180271

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!