budu/lobos — Issue #26: Lobos does not find backend when using {:datasource xxx} type config
Author: jsyrjala
Created: 2012-01-29 20:25:36+00:00
State: open

If I configure lobos to use a connection pool like this

(defn database-handle [dbh]
(let [connection-pool (doto (DataSource.)
(.setDriverClassName (dbh :classname))
(.setUrl (str "jdbc:" (:subprotocol dbh) ":" (:subname dbh)))
(.setUsername (:user dbh))
(.setPassword (:password dbh)) )]
{:datasource connection-pool }
))

(open-global (database-handle dbconfig))

I get following stacktrace. The problems is that lobos is assuming that :subprotocol key is available in configuration map. Maybe lobos should autodetect the subprotocol somehow or at least give better error message. The workaround is to define :subprotocol to database configuration map.

Exception in thread "main" java.io.FileNotFoundException: Could not locate lobos/backends/__init.class or lobos/backends/.clj on classpath: (NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5415)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$null_opt.invoke(main.clj:279)
...