Grails 配置 mysql

1.拷贝mysql-connector-java-5.1.10-bin.jar到Libraries目录下.

2.修改configuration/DataSource.groovy文件为:

dataSource {

pooled = true

driverClassName = "com.mysql.jdbc.Driver"

username = "root"

password = "root"

}

hibernate {

    cache.use_second_level_cache=true

    cache.use_query_cache=true

    cache.provider_class='net.sf.ehcache.hibernate.EhCacheProvider'

}

// environment specific settings

environments {

development {

dataSource {

dbCreate = "create-drop" // one of 'create', 'create-drop','update'

url = "jdbc:mysql://localhost/cms"

}

}

test {

dataSource {

dbCreate = "update"

url = "jdbc:mysql://localhost/cms"

}

}

production {

dataSource {

dbCreate = "update"

url = "jdbc:mysql://localhost/cms;shutdown=true"

}

}

}

你可能感兴趣的:(Hibernate,mysql,cms,jdbc,grails)