Created
August 19, 2015 00:43
-
-
Save squarepegsys/85a0fe380ab231391b8f to your computer and use it in GitHub Desktop.
HikariCP in Grails
This file contains 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
// Shameless stolen from http://stackoverflow.com/questions/25772324/defining-an-alternate-connection-pool-in-grails-2-3-6 | |
def config = Holders.config | |
def dataSources = config.findAll { | |
it.key.toString().contains("dataSource_") | |
} | |
dataSources.each { key, value -> | |
def ds = value | |
"${key}"(HikariDataSource, { bean -> | |
def hp = new Properties() | |
hp.username = ds.username | |
hp.password = ds.password | |
hp.connectionTimeout = 6000 | |
hp.maximumPoolSize = 60 | |
hp.jdbcUrl = ds.url | |
hp.driverClassName = ds.driverClassName | |
HikariConfig hc = new HikariConfig(hp) | |
bean.constructorArgs = [hc] | |
}) | |
} |
@abhilasha24 You have to set pooled = false
so that hikari can handle the pooling.
Is it working now @abhilasha24 ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
My grails application is not able to pick configuration changes for Hikari. That is how my resources.groovy looks like
and have my application.groovy as
That's my structure
Am I missing any other configuration?