Hi,
I found database connection pools to be the right thing to use with
c.j.jdbc and multiple databases.
https://clojars.org/org.bituf/clj-dbcp
(let [conn1 (make-pool-1)
conn2 (make-pool-2)]
(sql/with-connection conn1
(sql/with-query-results r [select ...]
(sql/with-connection
FWIW, the c.j.jdbc docs have an example of connection pooling:
http://clojure.github.com/java.jdbc/doc/clojure/java/jdbc/ConnectionPooling.html
On Mon, Dec 3, 2012 at 6:03 AM, Matthias Cords schlafbo...@gmail.comwrote:
Hi,
I found database connection pools to be the right thing to use with
Yeah, you probably shouldn't rely on this but I think it will still
work. I have done something similar before when reading from 3
databases simultaneously (3 nested with-connection and
with-query-result calls) and I believe (connection) is only called
once when creating the prepared statement.
On Tuesday, October 9, 2012 10:25:05 PM UTC-4, Sean Corfield wrote:
This is why c.j.jdbc is getting an API overall that will expose functions
that accept the connection or the db-spec directly (and the old API will be
rewritten in terms of the new one for compatibility).
Excellent.
-S
I'm trying to understand how 'binding' works, looking at the jdbc lib.
with-connection* binds *db* and then invokes a function. That function will
invoke other jdbc methods which do not take a connection parameter, so I
presume they are pulling the connection from *db*. As I understand it, the
Brian Craft craft.br...@gmail.com writes:
How would I do an operation involving two databases? I'd need to call
with-connection* from with-connection*? How would I then read from one
write to the other?
I've never used the jdbc lib, but essentially it should be something
along the lines of
On Tuesday, October 9, 2012 11:32:18 AM UTC-7, Tassilo Horn wrote:
Brian Craft craft...@gmail.com javascript: writes:
How would I do an operation involving two databases? I'd need to call
with-connection* from with-connection*? How would I then read from one
write to the other?
Brian Craft craft.br...@gmail.com writes:
Hi Brian,
If (read-stuff) is not lazy, then this looks pretty simple: all the
data is loaded in memory returned to (write-stuff). If the data is
large you wouldn't want it all in memory. What then? Could you make
read-stuff return a lazy sequence?
On Tuesday, October 9, 2012 12:11:28 PM UTC-7, Tassilo Horn wrote:
Brian Craft craft...@gmail.com javascript: writes:
Hi Brian,
If (read-stuff) is not lazy, then this looks pretty simple: all the
data is loaded in memory returned to (write-stuff). If the data is
large you
Can you not simply:
(jdbc/with-connection db2
(jdbc/with-query-results results
query
{:result-type :forward-only
:fetch-size 1000}
(jdbc/with-connection db1
;; read and write?
)))
?
On Tue, Oct 9, 2012 at 2:53 PM, Brian Craft craft.br...@gmail.com
No, the inner with-connection binds *db* to db1 so db2 is no longer
accessible.
This is why c.j.jdbc is getting an API overall that will expose functions
that accept the connection or the db-spec directly (and the old API will be
rewritten in terms of the new one for compatibility).
Sean
On
On Tue, Oct 9, 2012 at 12:53 PM, Brian Craft craft.br...@gmail.com wrote:
On Tuesday, October 9, 2012 12:11:28 PM UTC-7, Tassilo Horn wrote:
Yes, that's true. Maybe Korma [1] is better suited for this kind of
operation.
Thanks for the link to korma.
Korma is built on c.j.jdbc and may
12 matches
Mail list logo