Skip to content

Instantly share code, notes, and snippets.

@squarepegsys
Created August 19, 2015 00:43
Show Gist options
  • Save squarepegsys/85a0fe380ab231391b8f to your computer and use it in GitHub Desktop.
Save squarepegsys/85a0fe380ab231391b8f to your computer and use it in GitHub Desktop.
HikariCP in Grails
// 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]
})
}
@vikaschauhan17
Copy link

Is it working now @abhilasha24 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment