Last active
November 10, 2017 19:28
-
-
Save abadongutierrez/4665610 to your computer and use it in GitHub Desktop.
Grails: DataSource.groovy for MySQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataSource { | |
pooled = true | |
driverClassName = "com.mysql.jdbc.Driver" | |
username = "root" | |
password = "****" | |
dialect = org.hibernate.dialect.MySQL5InnoDBDialect | |
properties { | |
maxActive = 50 | |
maxIdle = 25 | |
minIdle = 5 | |
initialSize = 5 | |
minEvictableIdleTimeMillis = 1800000 | |
timeBetweenEvictionRunsMillis = 1800000 | |
maxWait = 10000 | |
ValidationQuery = 'select 1' | |
} | |
} | |
hibernate { | |
cache.use_second_level_cache = true | |
cache.use_query_cache = false | |
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' | |
} | |
// environment specific settings | |
environments { | |
development { | |
dataSource { | |
dbCreate = "none" // one of 'create', 'create-drop', 'update', 'validate', '' | |
url = "jdbc:mysql://localhost/db_dev?useOldAliasMetadataBehavior=true" | |
} | |
} | |
test { | |
dataSource { | |
dbCreate = "none" | |
url = "jdbc:mysql://localhost/db_test?useOldAliasMetadataBehavior=true" | |
} | |
} | |
production { | |
dataSource { | |
... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dataSource {
pooled = true
dbCreate = "update"
url = "jdbc:mysql://localhost:3306/yourDb"
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = "xxxx"
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
development {
dataSource {
pooled = true
dbCreate = "update"
url = "jdbc:mysql://localhost:3306/yourDb"
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = "xxxx"
}
}