This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-10-26
Channels
- # announcements (7)
- # babashka (6)
- # beginners (41)
- # clara (27)
- # clerk (2)
- # cljs-dev (6)
- # clojure (121)
- # clojure-europe (31)
- # clojure-nl (2)
- # clojure-norway (98)
- # clojure-uk (12)
- # clojuredesign-podcast (7)
- # conjure (5)
- # cursive (22)
- # holy-lambda (22)
- # hoplon (9)
- # hyperfiddle (19)
- # leiningen (9)
- # malli (4)
- # music (1)
- # nbb (6)
- # off-topic (10)
- # podcasts-discuss (1)
- # polylith (4)
- # re-frame (2)
- # reitit (2)
- # releases (1)
- # sci (1)
- # shadow-cljs (59)
- # sql (9)
- # vim (41)
- # xtdb (23)
I need to manage connection pooling for CockroachDB. As I don't have much experience with DB related stuff, could someone advise on where to begin? I was considering using tomekw/hikari-cp, but it doesn't have an adapter listed for Cockroach. Does this mean that I need to use brettwooldridge/HikariCP directly, without the Clj wrapper?
HikariCP is pretty straightforward to use directly. Also, next.jdbc
has pooling built-in, using HikariCP or c3p0.
https://cljdoc.org/d/com.github.seancorfield/next.jdbc/1.3.894/api/next.jdbc.connection#-%3Epool
I know, I saw it. I'm planning to migrate to next.jdbc at some point. Right now, I have to tread very carefully; I just started on this project a few days ago. It's written using org.clojure/java.jdbc, so I need to try keeping changes to a minimum. For now.
Ah, sorry. Well, then look at what ->pool
does and do that in your own code to create cpds
and then {:datasource cpds}
is your "db-spec" for c.j.j
Old Skool: https://clojure-doc.org/articles/ecosystem/java_jdbc/reusing_connections/ 🙂
Cockroach is (was?) wire-compatible with Postgres, so hikari-cp + PG driver should work, as per this doc: https://www.cockroachlabs.com/docs/stable/connection-pooling#example