Skip to content

Instantly share code, notes, and snippets.

@erangaeb
Created February 16, 2016 07:30
Show Gist options
  • Save erangaeb/7e09f6334d62ed7f7023 to your computer and use it in GitHub Desktop.
Save erangaeb/7e09f6334d62ed7f7023 to your computer and use it in GitHub Desktop.
ComboPooledDataSource configuration
val ds = new ComboPooledDataSource
ds.setDriverClass(driverName)
ds.setJdbcUrl(dbConfig.getString("url"))
ds.setUser(dbConfig.getString("username"))
ds.setPassword(dbConfig.getString("password"))
// most reliable way, but have visible peformance drop
ds.setTestConnectionOnCheckout(true)
// have better peformacne
ds.setTestConnectionOnCheckin(true)
ds.setIdleConnectionTestPeriod(30)
// this could work as well
ds.setPreferredTestQuery("SELECT 1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment