This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-13
Channels
- # aleph (8)
- # announcements (3)
- # beginners (36)
- # calva (1)
- # cider (1)
- # circleci (3)
- # clj-kondo (9)
- # cljdoc (58)
- # clojars (7)
- # clojure (70)
- # clojure-europe (13)
- # clojure-japan (1)
- # clojure-nl (8)
- # clojure-russia (2)
- # clojure-uk (7)
- # clojuredesign-podcast (4)
- # clojurescript (67)
- # clojureverse-ops (14)
- # cursive (6)
- # data-science (1)
- # datahike (3)
- # datomic (6)
- # docker (1)
- # events (2)
- # figwheel-main (9)
- # fulcro (4)
- # graalvm (33)
- # graphql (8)
- # helix (1)
- # jobs (1)
- # leiningen (3)
- # lsp (39)
- # malli (9)
- # minecraft (31)
- # nextjournal (7)
- # off-topic (6)
- # portal (22)
- # re-frame (5)
- # reitit (5)
- # remote-jobs (1)
- # shadow-cljs (55)
- # sql (22)
- # tools-build (3)
- # tools-deps (4)
- # xtdb (6)
@seancorfield For next-jdbc and jdbc.connection/->pool
, it seems that neither the docstring nor the docs mention how to set properties on the underlying Jdbc driver, right? That is understandable since it will differ for each pool but still an example in the docs would be nice. I currently do this for Hikari:
(jdbc.connection/->pool com.zaxxer.hikari.HikariConfig
{:dbtype "postgres" :host "localhost", :port 5432, :username "ardoq", :password "ardoq"
:dataSourceProperties
(doto (java.util.Properties.)
(.putAll {"socketTimeout" "30"}))})
Not sure whether there is a nicer way... (https://ask.clojure.org/index.php/11163/java-data-should-support-creating-properties-from-a-map)Thanks for creating an Ask for that - sounds like a good idea. Could you also create an issue on GH for next.jdbc so I don't forget? (I'm not at my desk yet)
(defn connection-pool-start
^HikariDataSource [config]
(connection/->pool HikariDataSource (merge config additional-config)))
There's a difference between additional configuration for the pool and additional configuration for the underlying datasource/driver.
See https://github.com/brettwooldridge/HikariCP/blob/ed2da5f1f4ef19f871fac12effc0b199706905dc/src/main/java/com/zaxxer/hikari/HikariConfig.java#L428 for example: these are specifically to configure the underlying JDBC objects, not the pool itself.
No worries. I was confused at first too -- since c3p0 has no such equivalent functionality as far as I can tell...
That is likely to become one of my (many) missions too I think...
https://github.com/seancorfield/next-jdbc/releases/tag/v1.2.737 updates java.data
to 1.0.92 and adds notes to the HikariCP documentation around this. Also improves documentation around :jdbcUrl
.
Awesome, thank you!
@seancorfield the explicit call to j/to-java is unnecessary, this works just fine:
user=> (def p (connection/->pool com.zaxxer.hikari.HikariConfig
{:dbtype "postgres" :dbname "db" :username "u" :password "p" :dataSourceProperties {:socketTimeout 30}}))
user=> (-> p .getDataSourceProperties)
{"socketTimeout" "30"}
https://github.com/seancorfield/next-jdbc/releases/tag/v1.2.737 updates java.data
to 1.0.92 and adds notes to the HikariCP documentation around this. Also improves documentation around :jdbcUrl
.