Grails连接mysql数据库

  1.Grails在连接mysql数据库是如果出现type=InnDe什么什么的错时,最好在将dataSource里面的方言(dialect)的值修改成

1 dataSource {
2     pooled = true
3     driverClassName = "com.mysql.jdbc.Driver"
4     username = "root"
5     password = "root"
6     dialect = org.hibernate.dialect.MySQL5InnoDBDialect  
7 }

  这样就可以顺利连接数据库

Grails - DataSource.groovy

 1 dataSource {
 2     pooled = true
 3     driverClassName = "com.mysql.jdbc.Driver"
 4     username = "root"
 5     password = "root"
 6     dialect = org.hibernate.dialect.MySQL5InnoDBDialect
 7 }
 8 hibernate {
 9     cache.use_second_level_cache = true
10     cache.use_query_cache = false
11     cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
12 }
13 // environment specific settings
14 environments {
15     development {
16         dataSource {
17             dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
18             url = "jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8"
19         }
20     }
21 }
如果有使用请标明来源:http://www.cnblogs.com/duwenlei/
原文地址:https://www.cnblogs.com/duwenlei/p/3668253.html