Question about the API
Closed this issue · 3 comments
Not really an issue, but mimicking the example code on the readme, it may look like jdbc/with-db-connection
avoids connection pooling by going directly to clojure.java.jdbc
. Or does
(jdbc/with-db-connection [conn {:datasource datasource}]
assign a free connection from the hikari managed pool?
I assume the latter, but just confirming here.
Hi @matanster, thanks for getting in touch. In all three cases in the readme we see:
(jdbc/with-db-connection [conn {:datasource datasource}]
...)
where datasource
is defined above using make-datasource
. make-datasource
comes from hikari-cp.core
and returns a datasource backed by a Hikari CP.
Does it answer your doubts? Maybe I'm misunderstanding your question? Is there any way those code samples could be improved and made clearer?
@matanster the conn
here is not a raw JDBC connection but a HikariCP managed proxy - so .close
doesn't close the connection in fact but releases the (open) connection to the pool.