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 }

 

posted @ 2014-04-16 11:45  哎呦喂,我的小祖宗╰つ  阅读(561)  评论(0编辑  收藏  举报