This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-12
Channels
- # aws (3)
- # beginners (28)
- # boot (3)
- # cider (28)
- # clara (5)
- # cljs-dev (107)
- # cljsrn (1)
- # clojure (40)
- # clojure-austin (2)
- # clojure-brasil (5)
- # clojure-canada (1)
- # clojure-italy (1)
- # clojure-spec (39)
- # clojure-uk (38)
- # clojurescript (33)
- # community-development (11)
- # cursive (11)
- # datomic (43)
- # duct (6)
- # emacs (7)
- # flambo (1)
- # fulcro (68)
- # graphql (11)
- # jobs (1)
- # jobs-discuss (8)
- # leiningen (16)
- # luminus (2)
- # lumo (1)
- # off-topic (38)
- # om (2)
- # onyx (15)
- # parinfer (32)
- # portkey (5)
- # re-frame (50)
- # reagent (50)
- # reitit (1)
- # shadow-cljs (63)
- # spacemacs (10)
- # sql (27)
- # unrepl (6)
- # yada (2)
this finally worked:
(let [url "jdbc:"
stmt (-> (DriverManager/getConnection url)
(.createStatement)
(.executeQuery "select * from users"))]
(while (.next stmt)
(println (.getString stmt "name"))))
but I had to add an exclusion to clojure.java.jdbc:
[org.postgresql/postgresql "42.0.0.jre7"]
[org.clojure/java.jdbc "0.4.2" :exclusions [org.postgresql]]
@seancorfield I guess clojure.java.jdbc is using [org.postgresql/postgresql "9.4.1212.jre7"]
and hasn't updated it for backwards compatibility?Are you really using 0.4.2
of java.jdbc
??? That's ancient!
And it shouldn't pull in any JDBC drivers so you should not need an exclusion.
The current version is [org.clojure/java.jdbc "0.7.5"]
@inbox
The java.jdbc
API has changed pretty radically since 0.4.2...
"Release 0.4.2 on 2015-09-15" <--
No wonder some of what I was suggesting you try didn't actually work 🙂
BTW @inbox I'm surprised your :exclusions
does anything if it's written as you showed -- org.postgresql
isn't an artifact ID (maybe that excludes every artifact in that group? Seems unlikely).
@seancorfield yeah, isn't doing anything, because I just tried this code:
(jdbc/with-db-connection [con-spec {:dbtype "postgresql"
:dbname "roc_test"
:user "roc"
:password "roc"
:currentSchema "ns1"}]
(jdbc/query con-spec ["SELECT * FROM users"]))
with these deps:
[org.postgresql/postgresql "42.0.0.jre7"]
[org.clojure/java.jdbc "0.7.5"]
and it works, but if I remove the [org.postgresql/postgresql "42.0.0.jre7"]
then the select query uses the default schema :thinking_face:
So clojure.java.jdbc doesn't have postgres jdbc driver as a dep? (sorry in advance for stupid questions, I'm new to all this artifact and deps in the java world)my project also has this dependency: https://github.com/juxt/modular/blob/master/modules/postgres/project.clj#L9 that might bes the driver I'm using by default that doesn't support the currentSchema
java.jdbc
deliberately does not pull in any JDBC drivers -- you have to do that yourself (so you have full control over which one(s) you use).
Per https://github.com/clojure/java.jdbc/blob/master/project.clj#L27-L28 those are just the driver versions I test against locally.
(the impossibl
driver was a fairly recent addition in the test matrix)
For Contrib projects, project.clj
is not relevant -- it doesn't affect how the project is built.
If you look in pom.xml
(which is how Contrib projects are built) https://github.com/clojure/java.jdbc/blob/master/pom.xml#L90 you'll see all the drivers are marked a test
scope...
awesome, well, running lein deps :tree
I see the driver hanging from modular.postgres so that must be the one I believe I should exclude
I may well replace project.clj
with deps.edn
instead since it's only useful for testing...
Feel free to bother me any time I'm around 🙂
Which is general 9am Pacific to about 11pm Pacific 🙂