There are a lot of documents about the configuration of the Grails project data source, but many of the documents will be grails1.x before, while the configuration of the grails1.x project data source is mostly vague; the Grails Official document also takes a stroke of this content.
Open any document about the configuration of the GRAILS1 data source on the web and tell us about the configuration of the data source in the Datasource.groovy file in the Grails-app/config directory of the Grails project.
The default configuration is:
dataSource {
pooled = false
driverClassName = "org.hsqldb.jdbcDriver"
username = "sa"
password = ""
}
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 = "create-drop" // one of 'create', 'create-drop','update'
url = "jdbc:hsqldb:mem:devDB"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:hsqldb:mem:testDb"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:hsqldb:file:prodDb;shutdown=true"
}
}
}
This configuration allows you to connect to the data source that the Grails project brings, which is no longer said.
The first thing I found on the Internet is the following modifications to the data source configuration:
dataSource {
pooled = false
driverClassName = "oracle.jdbc.driver.OracleDriver"
username = "test"
password = "test"
}
hibernate {
cache.use_second_level_cache=true
cache.use_query_cache=true
cache.provider_class='org.hibernate.cache.EhCacheProvider'
dialect = org.hibernate.dialect.Oracle9Dialect
}
// environment specific settings
environments {
development {
dataSource {
url = "jdbc:oracle:thin:@172.16.8.54:1430:test"
}
}
test {
dataSource {
url = "jdbc:oracle:thin:@172.16.8.54:1430:test"
}
}
production {
dataSource {
url = "jdbc:oracle:thin:@172.16.8.54:1430:test"
}
}
}