Hibernate和MySQL5.5创建表出错--'type=InnoDB'/schema export unsucessful
2014-08-13 14:59
399 查看
今天把以前做的一个项目迁移到自己的机器上,项目使用SSH。
第一次运行程序时,将Hibernte中的hibernate.hbm2ddl.auto设置成create,让Hibernate帮助自动建表,但不成功,报了如下信息:
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版本是5.0,现在换成了5.5,会不会与这有关呢。
后来,网上查找一番,发现是因为type=InnoDB在5.0以前是可以使用的,但5.1之后就不行了。如果我们把type=InnoDB改为engine=InnoDB就不会有这个问题。但是,我想使用Hibernate,自动帮我建表,怎么办呢。这就与我们指定的数据库方言(dialect)有关了。
之前我的配置是:
Xml代码:
现在改为:就是多了个5
第一次运行程序时,将Hibernte中的hibernate.hbm2ddl.auto设置成create,让Hibernate帮助自动建表,但不成功,报了如下信息:
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版本是5.0,现在换成了5.5,会不会与这有关呢。
后来,网上查找一番,发现是因为type=InnoDB在5.0以前是可以使用的,但5.1之后就不行了。如果我们把type=InnoDB改为engine=InnoDB就不会有这个问题。但是,我想使用Hibernate,自动帮我建表,怎么办呢。这就与我们指定的数据库方言(dialect)有关了。
之前我的配置是:
Xml代码:
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>
现在改为:就是多了个5
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
好了,这样问题就解决了。 原文地址: http://jasonhan-sh-hotmail-com.iteye.com/blog/1473955
相关文章推荐
- Hibernate和Mysql5.5创建表出错——type=InnDB/schema export unsuccessful
- Hibernate和Mysql5.5创建表出错——type=InnDB/schema export unsuccessful
- 创建SessionFactory出错Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- Hibernate与Mysql 5.5创建表出错--table doesn't exist
- MySQL server version for the right syntax to use near 'type=InnoDB' at line 1
- mysql报错:MySQL server version for the right syntax to use near 'type=InnoDB'
- MySQL创建索引抛出“required more than 'innodb_online_alter_log_max_size' bytes of modification log”异常的解决方案
- VC++ 2005中编译C出错:error C2143: syntax error : missing ';' before 'type'
- 使用TOMCAT5.5连接池连接mysql(解决Cannot create JDBC driver of class '' for connect URL 'null')
- 解决#1289 - The \'InnoDB\' feature is disabled; you need MySQL built with \'InnoDB\' to have it working的问题
- MYSQL中'TYPE=MyISAM'错误的解决方案
- MySQL恢复数据报错 #1289 - The &#39;InnoDB&#39; feature is disabled; you need MySQL built with &#39;InnoDB&#39; to hav
- 使用hibernate的SchemaExport来创建数据库
- 使用TOMCAT5.5连接池连接mysql(解决Cannot create JDBC driver of class '' for connect URL 'null')
- [MySQL参数取值] Status取值ERROR 1193 (HY000): Unknown system variable 'Innodb_buffer_pool_read_requests'
- mysql5.5 启动报错:File './mysql-bin.index' not found (Errcode: 13)
- mysql 5.5 中mysqldump: Got error: 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' fo
- 解决Navicat数据传输问题:The‘InnoDB’feature is disabled; you need MySQL built with ‘InnoDB'...
- VC++ 2005中编译C出错:error C2143: syntax error : missing ';' before 'type'
- MySQL备份/还原 Unknown storage engine 'InnoDB'