I've been tearing my hair out over an issue with db-spec
s in clojure.java.jdbc. I'm wondering if some behavior has changed recently, because something almost identical to this worked up until very recently.
My db-spec looks like this:
(defn prod []
"Yes, I've verified all of the loaded properties are accurate for the connection"
{ :classname (get-property "acedia.bbts")
:subprotocol (get-property "acedia.bbts.subprotocol")
:subname (str "@" (get-property "acedia.bbts.dev.host") ":" (get-property "acedia.bbts.dev.port") ":" (get-property "acedia.bbts.dev.sid"))
:user (get-property "acedia.bbts.dev.user")
:password (get-property "acedia.bbts.dev.password")})
And then at the REPL:
user => (prod)
{:classname "oracle.jdbc.driver.OracleDriver", :subprotocol "oracle", :subname "@hostname:1521:bbts", :user "user", :password "pass"}
user=> (with-connection bbts-dev (with-query-results rs ["select * from customer where rownum < 10"] (dorun (map #(println (:firstname %)) rs))))
user => (use 'clojure.stacktrace)
nil
user => (e)
java.lang.IllegalArgumentException: db-spec acedia.db.bbts$prod@4d24bd93 is missing a required parameter
at clojure.java.jdbc.internal$get_connection.invoke (internal.clj:147)
clojure.java.jdbc.internal$with_connection_STAR_.invoke (internal.clj:154)
user$eval1116.invoke (NO_SOURCE_FILE:1)
clojure.lang.Compiler.eval (Compiler.java:6465)
clojure.lang.Compiler.eval (Compiler.java:6431)
clojure.core$eval.invoke (core.clj:2795)
clojure.main$repl$read_eval_print__5967.invoke (main.clj:244)
clojure.main$repl$fn__5972.invoke (main.clj:265)
nil
I have no idea what the NO_SOURCE_FILE
is in reference to, either. I've verified that the oracle driver is accessible, loaded, etc., as well. What parameter could I be missing in the db-spec?
Note: I have the same problem with MS SQL Server.
The issue is that prod
is a function, so either change prod to be (def prod {all props here})
or call the prod function when needed: (with-connection (prod) (with-query-results
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With