8

I've been tearing my hair out over an issue with db-specs 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.

1
  • 1
    user$eval1116.invoke (NO_SOURCE_FILE:1) refers to you typing at the REPL Commented Sep 5, 2012 at 18:23

1 Answer 1

9

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.