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?
Hmm... maybe I can just use postgres adapter settings?
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