Fork me on GitHub

Im trying to use @seancorfield’s config but Im getting a missing parameter error (it doesnt says which one though)

CompilerException java.lang.IllegalArgumentException: db-spec com.mchange.v2.c3p0.ComboPooledDataSource[ identityToken -> 1hge13j9s17njdkd8lln19|49c17ba4, dataSourceName -> scheduler-ds ] is missing a required parameter, compiling: ...
here is the code im trying to use:
(def db-spec (doto (ComboPooledDataSource.)
               (.setDataSourceName "scheduler-ds")
               (.setDriverClass "com.mysql.jdbc.Driver")
               (.setJdbcUrl (str "jdbc:mysql://"
                                 (:db-host cfg)
                                 ":" (:db-port cfg)
                                 "/" (:db-name cfg)
               (.setUser (:db-user cfg))
               (.setPassword (:db-password cfg))
               ;; pool size (default is 3 and 15):
               (.setMinPoolSize 3)
               (.setMaxPoolSize 15)
               (.setNumHelperThreads 3)
               ;; initial pool size default is 3 but actual pool size
               ;; must be between minimum and maximum pool size
               (.setInitialPoolSize 3)
               ;; expire excess connections after 10 mins of inactivity:
               (.setMaxIdleTimeExcessConnections (* 10 60))
               ;; expire connections after 61 minutes of inactivity:
               (.setMaxIdleTime (* 61 60))
               ;; idle connection testing
               ;(.setAutomaticTestTable "c3p0connection")
               (.setTestConnectionOnCheckin true)
               (.setIdleConnectionTestPeriod (* 11 60))
               ;; unreturned (app leakage) get zapped after an hour:
               (.setUnreturnedConnectionTimeout (* 59 60))))
this previous config was kinda working
(def old-db-spec (pool/make-datasource-spec
                  {:subprotocol "mysql"
                   :user        (:db-user cfg)
                   :password    (:db-password cfg)
                   :subname     (str "//" (:db-host cfg)
                                     ":" (:db-port cfg)
                                     "/" (:db-name cfg)


Your db-spec should be a hash map.


{:datasource (doto ...)}


@seancorfield not sure why, but the problem went away using your configuration, thank you very much!!!


Excellent! Probably the array of timeouts.


Strangely, we're testing a new MySQL setup and one query is giving us a communications link failure consistently (all the other queries we've run seem to work as expected). But I don't think it's our code 🙂 I think there's an issue with the ProxySQL setup so I'm working with our DBAs on that.


good luck with that 🙂