我是 grails 和 intellij ide 的新手。我在 intellij 中运行了一个 grails 项目,没关系。但是现在我需要使用mysql数据库而不是默认的。我不知道该怎么做。据我所知,我已经改变了我的数据源类,如下所示>>>
dataSource {
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
properties {
initialSize = 5
maxActive = 10
minIdle = 5
maxIdle = 5
maxWait = 100000
validationQuery = "select 1"
minEvictableIdleTimeMillis = 60000
timeBetweenEvictionRunsMillis = 60000
}
}
hibernate {
cache.use_second_level_cache = false
cache.use_query_cache = false
cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop','update'
loggingSql = true
url = "jdbc:mysql://localhost/sbicloud_jan_13"
username = "root"
password = "admin"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:mysql://192.168.18.12/sbicloud"
username = "zia"
password = "zia123321"
}
}
production {
dataSource {
}
}
}
当我运行应用程序时,控制台中会出现一些错误,第一个错误如下 >>>
Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
谁能帮我解决这个问题?!这对我很有帮助。