Reputation: 13
I'm at that point where frustration just makes you incapable of seeing the solution...
My project.clj
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/java.jdbc "0.4.2"]
[org.postgresql/postgresql "9.4.1208"]]
lein deps
(all is okay)Run my query:
(db/query "postgresql://user:secret@host"
["select * from table limit 1"])
I get the following error:
- Unhandled java.sql.SQLException No suitable driver found for
jdbc:postgresql://host
...Please. Any ideas?
Upvotes: 1
Views: 241
Reputation: 4629
maybe your db spec is wrong, I use postgresql spec:
postgres://user:password@host:5432/mydb
Upvotes: 0
Reputation: 14197
Probably need to specify the java driver to use and the other parameters in the db descriptor.
I usually use something similar to:
(use 'clojure.java.jdbc)
(let [db { :classname "org.postgresql.Driver"
:subprotocol "postgresql"
:subname "//192.168.99.100:5432/postgres"
:user "postgres"
:password "mysecretpassword"}]
(query db ["select count(*) from example" ]) )
; ({:count 6005247})
Upvotes: 2