Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. class DbStorage {
  2. val connPoolConfig = new BoneCPConfig()
  3. connPoolConfig.setJdbcUrl(jdbcConnStr)
  4. connPoolConfig.setUsername(userName)
  5. connPoolConfig.setPassword(password)
  6. connPoolConfig.setMinConnectionsPerPartition(5)
  7. connPoolConfig.setMaxConnectionsPerPartition(30)
  8. connPoolConfig.setPartitionCount(5)
  9. val dataSource = new BoneCPDataSource(connPoolConfig)
  10. dataSource.setDriverClass(driver)
  11.  
  12. def getConnection :Connection = {
  13. dataSource.getConnection
  14. }
  15.  
  16. def closeConnection(conn: Connection): Unit = {
  17. conn match {
  18. case c:Connection => c.close()
  19. case _ =>
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement