`
sillycat
  • 浏览: 2492721 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

grails(二)简单项目示例

阅读更多
grails(二)简单项目示例

1.数据库配置
配置文件 grails-app/conf/DataSource.groovy
A typical configuration for MySQL may be something like:
dataSource {
pooled = true
dbCreate = "update"
url = "jdbc:mysql://localhost/yourDB"
driverClassName = "com.mysql.jdbc.Driver"
username = "yourUser"
password = "yourPassword"
}

my configuration:
dataSource {
pooled = true
dbCreate = "update"
driverClassName = "com.mysql.jdbc.Driver"
username = "easygrails"
password = "easygrails"
}
hibernate {
    cache.use_second_level_cache=true
    cache.use_query_cache=true
    cache.provider_class='com.opensymphony.oscache.hibernate.OSCacheProvider'
}
// environment specific settings
environments {
development {
   dataSource {
    dbCreate = "create-drop" // one of 'create', 'create-drop','update'
    url = "jdbc:mysql://www.sillycat.com/grails_dev"
   }
}
test {
   dataSource {
    dbCreate = "update"
    url = "jdbc:mysql://www.sillycat.com/grails_test"
   }
}
production {
   dataSource {
    dbCreate = "update"
    url = "jdbc:mysql://www.sillycat.com/grails_product"
   }
}
}

启动报错:
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:146)

检查发现太兴奋了,数据库的驱动程序没有拷贝过来
拷贝文件mysql-connector-java-5.1.6.jar到lib目录下
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics