ibdknox/Korma — pull request #53 by jsyrjala (2012-03-30 20:42:38+00:00)
Title: Added support for customizing connection pools

Hi,

Attached patch adds :connection-pool-factory attribute to db spec.

Example:

(defn create-bonecp-connection-pool
(let [connection-pool (doto (BoneCPDataSource.)
(.setDriverClass (spec :classname))
(.setJdbcUrl (str "jdbc:" (:subprotocol spec) ":" (:subname spec)))
(.setUsername (:user spec))
(.setPassword (:password spec))
(.setPartitionCount 3)
(.setMaxConnectionsPerPartition 26)
(.setStatementsCacheSize 100)
)]
{:datasource connection-pool}))

(def database-config
{:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:user "..."
:password "..."
:subname "//localhost/some_db"
:connection-pool-factory create-bonecp-connection-pool
})