Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.mchange.v2.c3p0.ComboPooledDataSource
- import org.codehaus.groovy.grails.commons.ConfigurationHolder as CH
- import org.codehaus.groovy.grails.commons.GrailsApplication
- import grails.util.GrailsUtil
- // Place your Spring DSL code here
- beans = {
- /**
- * c3P0 pooled data source that allows 'DB keepalive' queries
- * to prevent stale/closed DB connections
- * Still using the JDBC configuration settings from DataSource.groovy
- * to have easy environment specific setup available
- */
- dataSource(ComboPooledDataSource) { bean ->
- bean.destroyMethod = 'close'
- def ds = CH.config.dataSource
- user = ds.username
- password = ds.password
- driverClass = ds.driverClassName
- jdbcUrl = ds.url
- initialPoolSize = 5
- minPoolSize = 5
- maxPoolSize = 30
- acquireIncrement = 3
- maxConnectionAge = 2 * 60 * 60
- maxIdleTime = 60 * 60
- maxStatements = 0
- maxStatementsPerConnection = 0
- numHelperThreads = 10
- idleConnectionTestPeriod = 240
- preferredTestQuery = "select 1"
- testConnectionOnCheckin = true
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement