Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-10 Thread larry google groups
Thank you much. You suggest a good approach: I'll just get it working and then I'll worry about performance later. On Friday, November 9, 2012 7:29:45 PM UTC-5, Sean Corfield wrote: On Fri, Nov 9, 2012 at 3:17 PM, larry google groups lawrenc...@gmail.com javascript: wrote:

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-10 Thread Sean Corfield
On Sat, Nov 10, 2012 at 9:21 AM, larry google groups lawrencecloj...@gmail.com wrote: Thank you much. You suggest a good approach: I'll just get it working and then I'll worry about performance later. And as I said, happy to help you off-list since a) I maintain java.jdbc and b) I've been using

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-10 Thread larry google groups
Thank you very much for all of your help. I am curious, is there anyway to print out the sql that is actually run against the database? I looked here but didn't see anything obvious: https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj On Saturday, November

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-10 Thread Sean Corfield
On Sat, Nov 10, 2012 at 12:27 PM, larry google groups lawrencecloj...@gmail.com wrote: Thank you very much for all of your help. I am curious, is there anyway to print out the sql that is actually run against the database? I looked here but didn't see anything obvious:

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-10 Thread larry google groups
Yes, thank, I saw that conversation from 2011 when I was searching Google. Maybe at some point I'll know Clojure and Java well enough that I can contribute something to these projects. On Saturday, November 10, 2012 5:55:29 PM UTC-5, Sean Corfield wrote: On Sat, Nov 10, 2012 at 12:27 PM,

does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread larry google groups
Sorry this is such an ignorant question, but I am new to Clojure and the JVM. I am tring to find info about clojure.java.jdbc so I looked here: http://corfield.org/blog/post.cfm/connecting-clojure-and-mysql and saw this example: (ns mysql.core (:require [clojure.java.jdbc :as sql])) (def

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Sean Corfield
On Fri, Nov 9, 2012 at 9:42 AM, larry google groups lawrencecloj...@gmail.com wrote: Can I assume that sql/with-connection does some magic in the background to manage the connection? I would not want the connection to get shut down, and then restarted, everytime I run a query. Use a connection

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Jim foo.bar
the general idiom with-some-resource means that resources will be cleared after leaving its scope. JUst like with 'with-open' which has a try/finally in order to .close() any closable resource upon exit. I've not used clojure.java.jdbc but I suspect the same rationale applies for

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread larry google groups
Thank you. Again, apologies for the ignorant questions. I'm reading over this: http://clojure.github.com/java.jdbc/ If I read this correctly, once I have the db connection, I can use a combination of prepare-statement and do-prepared to run the select statements that i need to make?

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Sean Corfield
I'm not sure why you'd need to use those low-level APIs for normal queries etc? Perhaps you can explain a bit more about what you're trying to do. Have you looked at this page: http://clojure.github.com/java.jdbc/doc/clojure/java/jdbc/UsingSQL.html Sean On Fri, Nov 9, 2012 at 10:13 AM, larry

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread larry google groups
I am looking here: http://clojure.github.com/java.jdbc/ I notice this: do-commands Usage: (do-commands commands) Executes SQL commands on the open database connection. This seems flexible, but how does it know what the open database connection is? I have to switch between 2 databases.

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread larry google groups
the general idiom with-some-resource means that resources will be cleared after leaving its scope. JUst like with 'with-open' which has a try/finally in order to .close() any closable resource upon exit. I've not used clojure.java.jdbc but I suspect the same rationale applies for

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Sean Corfield
On Fri, Nov 9, 2012 at 10:19 AM, larry google groups lawrencecloj...@gmail.com wrote: Usage: (do-commands commands) This seems flexible, but how does it know what the open database connection is? I have to switch between 2 databases. do-commands is intended for DDL. All of these API methods

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread larry google groups
do-commands is intended for DDL. All of these API methods are intended to be used inside (with-connection ...) which is how they know which DB connection to use. Again: Perhaps you can explain a bit more about what you're trying to do. Have you looked at this page:

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Sean Corfield
On Fri, Nov 9, 2012 at 3:17 PM, larry google groups lawrencecloj...@gmail.com wrote: http://clojure.github.com/java.jdbc/doc/clojure/java/jdbc/UsingSQL.html I will read over that page. I have no experience with Java, which would probably help as there seem to be an abundance of Java examples