Skip to content
Snippets Groups Projects
Commit 60544112 authored by Andrew Stiegmann (stieg)'s avatar Andrew Stiegmann (stieg)
Browse files

Migrate C3P0 config settings to c3p0.properties file

As per configuration_precedence document noted in the c3p0 config doc
(https://www.mchange.com/projects/c3p0/#configuration_precedence) any
setting which is specified programatically may not be overridden by
other external settings such as system properties.  This creates an
issue if an admin wishes to set any of these settings.

In my case I was attempting to have c3p0 shut down all connections
to my RDS instance so that amazon would spin the instance down while
not in use.  Alas it appears that something else seems to re-establish
connectinons every few seconds and prevent my desired behavior. But
before I abondon this approach I figured this would be a good PR
for the project as it will enable others to set this settings as they
see fit and not hit the same roadblocks I hit along the way.

Of note I have removed the maxPoolSize setting as the current value
of 15 is the same as the driver default. The other settings remain.
parent f4dc152b
No related merge requests found
c3p0.initialPoolSize=1
c3p0.minPoolSize=1
......@@ -341,17 +341,11 @@
;;; | CONNECTION POOLS & TRANSACTION STUFF |
;;; +----------------------------------------------------------------------------------------------------------------+
(def ^:private application-db-connection-pool-properties
"c3p0 connection pool properties for the application DB. See
https://www.mchange.com/projects/c3p0/#configuration_properties for descriptions of properties."
{"minPoolSize" 1
"initialPoolSize" 1
"maxPoolSize" 15})
(defn- new-connection-pool
"Create a C3P0 connection pool for the given database `spec`."
"Create a C3P0 connection pool for the given database `spec`. Default c3p0 properties can be found in the
c3p0.properties file and are there so users may override them from the system if desired."
[spec]
(connection-pool/connection-pool-spec spec application-db-connection-pool-properties))
(connection-pool/connection-pool-spec spec))
(defn- create-connection-pool! [spec]
(db/set-default-quoting-style! (case (db-type)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment