只需要修改DataSource.groovy就可以了:
eg:
dataSource {
pooled = false
// driverClassName = "org.hsqldb.jdbcDriver"
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = "root"
}
hibernate {
cache.use_second_level_cache=true
cache.use_query_cache=true
cache.provider_class='org.hibernate.cache.EhCacheProvider'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop','update'
// url = "jdbc:hsqldb:mem:devDB"
url = "jdbc:mysql://localhost/jp_ad_sys?useUnicode=true&characterEncoding=UTF8"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:mysql://localhost/jp_ad_sys?useUnicode=true&characterEncoding=UTF8"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:mysql://localhost/jp_ad_sys?useUnicode=true&characterEncoding=UTF8"
}
}
}
PS:
注意了Grails会自己创建数据表的,dbCreate那个值非常的重要
阅读(2038) | 评论(0) | 转发(0) |