The `db-spec` can have a `:connection` member and all operations will use that. You are responsible for closing it when you're done. Something like (untested, off the top of my head):
(with-open [conn (get-connection db-spec)] (let [db (assoc db-spec :connection conn)] ... (query db ...) ... (insert! db ...) ...)) This sort of thing needs to be added to the (community-editable) documentation since it's one of the most frequently asked questions: http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html For the most part, the way we use it at World Singles is to define a pool datasource connection and use that as the db-spec (which _is_ documented at that URL for both c3p0 and BoneCP). Sean On Wed, Aug 14, 2013 at 8:02 PM, Kyle Cordes <kyle.cor...@gmail.com> wrote: > Hello. I've coded quite a lot of JDBC usage in Java, and enough Clojure to > know my way around pretty well; yet I've been unable to figure out the > following by reading the source and docs for clojure.java.jdbc. I've read > http://clojure.github.io/java.jdbc/ and many pages linked from there. > > The question is: > > How do I get a connection, then run a series of operations on that same > connection? All the API I can find (except for the deprecated, pre-0.3 API) > seems to work on a model of: give it a DB connection spec, it connects, > runs, and disconnects. Great for playing with a command at a time, less so > for doing a series of things that need to happen on the same connection. > > -- > Kyle Cordes > http://kylecordes.com > > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ "Perfection is the enemy of the good." -- Gustave Flaubert, French realist novelist (1821-1880) -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.