This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-17
Channels
- # announcements (7)
- # babashka (56)
- # beginners (114)
- # bristol-clojurians (4)
- # calva (22)
- # cider (7)
- # clara (1)
- # clj-kondo (17)
- # cljs-dev (1)
- # clojure (93)
- # clojure-europe (8)
- # clojure-italy (5)
- # clojure-nl (2)
- # clojure-uk (79)
- # clojuredesign-podcast (18)
- # clojurescript (108)
- # code-reviews (6)
- # cursive (3)
- # data-science (16)
- # datomic (151)
- # duct (7)
- # emacs (10)
- # events (1)
- # fulcro (76)
- # luminus (8)
- # off-topic (3)
- # other-lisps (2)
- # pathom (8)
- # re-frame (5)
- # reitit (8)
- # schema (9)
- # shadow-cljs (37)
- # specter (3)
- # sql (17)
- # tree-sitter (2)
- # yada (9)
With next.jdbc
I’m trying to move some code from clojure.java.jdbc
that uses a string URL like so. "
. However this ends up different than using the spec hashmap when passed to (jdbc/get-datasource db-spec)
. If I use the existing URL the queries fail. What am I doing wrong?
using the information in that connection string can you create a db-spec with the required information?
This is datasource when I provide the details as the spec hash.
#object[next.jdbc.connection$url_PLUS_etc$reify__6503 0x3e3886c2 "jdbc:
This is when I provide the URL
#object[next.jdbc.connection$url_PLUS_etc$reify__6503 0x16e837fc "
can you validate your db-spec? (clojure.spec.alpha/valid? :next.jdbc.specs/db-spec {:dbtype "postgres" :dbname "bob" :username "bob" :password "secretbob"})
Ok I will try. I can run queries with the db-spec hash just not the URL.
Both validate as true
next.jdbc
requires the jdbc:
prefix.
clojure.java.jdbc
incorrectly let you omit it and it worked anyway (for some drivers?).
The JDBC spec says all URLs must begin with jdbc:
.
Ah thanks!
It's mentioned in https://cljdoc.org/d/seancorfield/next.jdbc/1.0.409/doc/migration-from-clojure-java-jdbc by the way.
About halfway down the page "Note that clojure.java.jdbc allowed the jdbc: prefix in a JDBC URI to be omitted but next.jdbc requires that prefix!"
I will open an issue to update the spec to check the format of the URL anyway, so at least if folks instrument next.jdbc
it would fail validation.