This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-03
Channels
- # announcements (11)
- # aws (1)
- # beginners (57)
- # calva (14)
- # cider (22)
- # clara (23)
- # cljdoc (21)
- # cljs-dev (14)
- # clojure (76)
- # clojure-austin (3)
- # clojure-europe (32)
- # clojure-finland (1)
- # clojure-gamedev (5)
- # clojure-italy (3)
- # clojure-nl (17)
- # clojure-poland (4)
- # clojure-spec (23)
- # clojure-uk (29)
- # clojurescript (72)
- # cursive (6)
- # data-science (4)
- # datomic (2)
- # dirac (10)
- # duct (3)
- # emacs (1)
- # figwheel-main (10)
- # fulcro (86)
- # jackdaw (5)
- # juxt (2)
- # kaocha (2)
- # leiningen (16)
- # off-topic (47)
- # pathom (46)
- # protorepl (2)
- # reagent (4)
- # reitit (14)
- # ring-swagger (5)
- # shadow-cljs (43)
- # spacemacs (13)
- # sql (13)
- # tools-deps (6)
@seancorfield Thank you very much! What you suggested worked just fine!
In a production app, is it best to pass a db-spec map or a persistent connection to the jdbc api?
a db-spec map pointing to a connection pool object
{:datasource pooled-datasource-object}
is what we use at work @kenny where pooled-datasource-object
is a c3p0
connection pool object
Then the clojure.java.jdbc
functions call .getConnection
on the PDS each time they need a connection, which is low overhead.
See http://clojure-doc.org/articles/ecosystem/java_jdbc/reusing_connections.html
(that shows c3p0 specifically but any connection pooling library will suffice there)
Oh, didn't see that doc. Thanks! Is passing the db-spec map without pooling to jdbc significantly more expensive than pooling?
Creating a new database connection is significantly more expensive than getting one from a connection pool, yes.
Because there are multiple pooling libraries and because Contrib libs generally try to avoid external dependencies
We happen to use c3p0 at work but a lot of people use Hikari-CP I think. There's another popular one too.