Skip to content

Instantly share code, notes, and snippets.

@uarun
Created August 3, 2011 19:35
Show Gist options
  • Save uarun/1123566 to your computer and use it in GitHub Desktop.
Save uarun/1123566 to your computer and use it in GitHub Desktop.
Pooled DataSource configuration in Grails
dataSource {
pooled = true
driverClassName = "oracle.jdbc.driver.OracleDriver"
username = "user"
password = "password"
properties {
maxActive = 10
maxIdle = 10
minIdle = 0
initialSize = 3
maxWait = 60 * 1000; //... Timeout for borrowConnection()
minEvictableIdleTimeMillis = 30 * 60 * 1000 //... Evict Connections idle for 30 mins
timeBetweenEvictionRunsMillis = 15 * 60 * 1000 //... Run Evictor every 15 mins
numTestsPerEvictionRun = 3 //... Test 3 connections everytime the evictor runs
testOnBorrow = true
testOnReturn = false
testWhileIdle = true
validationQuery = "SELECT 1 FROM dual"
}
}
hibernate {
generate_statistics = true
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider'
}
environments {
development {
dataSource {
dbCreate = "" // one of 'create', 'create-drop','update'
url = "jdbc:oracle:thin:@<server>:<port>/<service>"
}
}
test {
dataSource {
dbCreate = ""
url = "jdbc:oracle:thin:@<server>:<port>/<service>"
}
}
production {
dataSource {
dbCreate = ""
url = "jdbc:oracle:thin:@<server>:<port>/<service>"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment