Re: clojure.contrib.sql and multiple connections

2011-06-22 Thread Matthias Cords
Naturally, a connection pool is to clojure database programming what baked beans are to ham and egg. I am thinking that the size of the connection pool must be determined by the number of workers that may simultaneously work in the connected database, but that's a detail. thank you very much for

Re: clojure.contrib.sql and multiple connections

2011-06-21 Thread Shantanu Kumar
The canonical way to use databases with JDBC is to have connection- pooled DataSource (instead of Connection) instances. That will make sure connections are not created unnecessarily are are re-used across operations. This may help create those: https://bitbucket.org/kumarshantanu/clj-dbcp/src/tip

Re: clojure.contrib.sql and multiple connections

2011-06-21 Thread Matthias Cords
thank you, this sounds very reasonable. very often there is more than one piece of data to copy back and forth. so typically i do a sql select, then put that to destination data store, do another sql select and put to destination, ... and so forth. from my understanding (sql/with-connection ...)

Re: clojure.contrib.sql and multiple connections

2011-06-20 Thread Shantanu Kumar
Write different functions for source and target? (declare source-conn) (declare target-conn) (defn get-source-data [] (sql/with-connection source-conn ...)) (defn put-target-data [data] (sql/with-connection target-conn ...)) (defn data-transfer [] (let [source (get-source-da

clojure.contrib.sql and multiple connections

2011-06-20 Thread MattC
Hi, I am writing a lot of programs shuffling data between databases and would like to use Clojure for some of it. While investigating the sql contrib library I was wondering whether there is a supported way to have more than one database connection open at any one time. My initial approach was