Fork me on GitHub
#sql
<
2023-10-26
>
ag22:10:42

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?

ag22:10:52

Hmm... maybe I can just use postgres adapter settings?

seancorfield22:10:24

HikariCP is pretty straightforward to use directly. Also, next.jdbc has pooling built-in, using HikariCP or c3p0.

ag22:10:31

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.

seancorfield22:10:39

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

lukasz23:10:58

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

👍 1