I think you can use db-connection, something like:

  (let [conn (db-connection spec)
         meta (.getMetaData conn)]
    (doall (.getTables meta nil "schema" "%s" nil))
    (.close conn))

Or what have you. I wrote a little macro `with-meta-data` that was something 
like that, with added try/catch/finally to make sure the conn got closed. 

Is `with-open` a possibility?

  (with-open [conn (db-connection spec)]
     …)

Would that work?
    
On 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.

-- 
-- 
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.

Reply via email to