java.jdbc

get-connection returns an error

Details

  • Type: Defect Defect
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    PostgreSQL

Description

My db-spec is:
(def db-spec {:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:subname "sd_ventures_development"
:user "sd_ventures"
:password ""})

When I query using the old API:
(defn get-devices []
(jdbc/with-connection db-spec
(jdbc/with-query-results rs ["SELECT * FROM devices"]
(doall rs))))

it works and I get the list of devices.

With the new API -
(defn get-devices []
(let [conn (jdbc/get-connection db-spec)]
(jdbc/query conn ["SELECT * FROM devices"])))
it returns an error:
Exception: java.lang.IllegalArgumentException: db-spec org.postgresql.jdbc4.Jdbc4Connection@4c54daa9 is missing a required parameter
jdbc.clj:221 clojure.java.jdbc/get-connection
jdbc.clj:628 clojure.java.jdbc/db-with-query-results*

I am completely bowled over by this error. I checked the source code. It should never reach that statement in get-connection because I am supplying both subname and subprotocol.

Activity

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: