diff --git a/CHANGELOG.md b/CHANGELOG.md index cd4a9d0..785ba32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Only accretive/fixative changes will be made from now on. * 1.2.next in progress + * Address [#207](https://github.com/seancorfield/next-jdbc/issues/207) by supporting "db-spec" hash maps containing `:datasource` or `:connection-uri` (this is otherwise undocumented and intended to aid migration from `clojure.java.jdbc`). * Address [#199](https://github.com/seancorfield/next-jdbc/issues/199) by adding notes on UTC usage -- [@denismccarthykerry](https://github.com/denismccarthykerry). * Enhance `insert-multi!` to accept a sequence of hash maps and also to support batch execution, via PR [#206](https://github.com/seancorfield/next-jdbc/pull/206) -- [@rschmukler](https://github.com/rschmukler). * Fix HikariCP pooling example. diff --git a/src/next/jdbc/connection.clj b/src/next/jdbc/connection.clj index f13af1f..4b0bd39 100644 --- a/src/next/jdbc/connection.clj +++ b/src/next/jdbc/connection.clj @@ -406,7 +406,13 @@ (extend-protocol p/Sourceable clojure.lang.Associative (get-datasource [this] - (url+etc->datasource (spec->url+etc this))) + ;; #207 c.j.j compatibility: + (if-let [datasource (:datasource this)] + datasource + (url+etc->datasource + (if-let [uri (:connection-uri this)] + (string->url+etc uri) + (spec->url+etc this))))) javax.sql.DataSource (get-datasource [this] this) String