This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-28
Channels
- # beginners (45)
- # boot (4)
- # cider (5)
- # cljs-dev (8)
- # cljsrn (4)
- # clojure (38)
- # clojure-conj (7)
- # clojure-dev (4)
- # clojure-russia (3)
- # clojure-spec (20)
- # clojure-uk (3)
- # clojurescript (28)
- # core-logic (29)
- # figwheel-main (10)
- # fulcro (2)
- # onyx (1)
- # other-languages (5)
- # parinfer (3)
- # pathom (98)
- # portkey (1)
- # reagent (15)
- # reitit (9)
- # shadow-cljs (22)
- # spacemacs (10)
- # sql (22)
- # tools-deps (1)
There are 2 cases for oracle db connection URI: jdbc:oracle:thin:@<hostName>:<portNumber>:<sid>; (if you have sid) jdbc:oracle:thin:@<hostName>:<portNumber>/serviceName; (if you have oracle service name)
E.g. (def my-oracle-db {:dbtype "oracle" :dbname "dbname"... creates URI jdbc:oracle:thin:@host:port/dbname
Could I ask to add the check for a "sid" string, so if I write (def my-oracle-db {:dbtype "oracle" :dbname "sid:dbname"... I'll receive the following URI: jdbc:oracle:thin:@host:port:dbname
it's a java.jdbc\src\main\clojure\clojure\java\jdbc.clj:384 db-sep (if (= "sqlserver" subprotocol) ";DATABASENAME=" "/")
Here is a probable solution: db-sep (if (= "sqlserver" subprotocol) ";DATABASENAME=" "/") url (cond (= "h2:mem" dbtype) (str "jdbc:" subprotocol ":" dbname ";DB_CLOSE_DELAY=-1") (#{"derby" "h2" "hsqldb" "sqlite"} subprotocol) (str "jdbc:" subprotocol ":" dbname) + (= "oracle" dbtype) + (str "jdbc:" subprotocol ":" + (host-prefixes subprotocol "//") + host + (when port (str ":" port)) + (if (= (.indexOf (str dbname) "sid:") 0) + (str ":" (str/replace dbname #"sid:" "")) + (str "/" dbname))) :else (str "jdbc:" subprotocol ":" (host-prefixes subprotocol "//") host (when port (str ":" port)) db-sep dbname))
@kostafey Can you open a JIRA ticket with some details so I don't forget?
Here's the URL to save you digging around https://dev.clojure.org/jira/browse/JDBC
Thanks. I'll try to get a patch release out with that some time this week.
It'll be better to modify this line to deal with the db-sep
value
db-sep (if (= "sqlserver" subprotocol) ";DATABASENAME=" "/")
Also, I think I'd rather introduce a pseudo-subprotocol, oracle:sid
, to handle this case.
But I'll give that some thought.
I don't really like the dbname
having a "magic" prefix that goes away when the JDBC URL is constructed.
Since it works with both new and old-style connections. But probably someday later it will become deprecated.
OK, fix for that pushed to GitHub. If you're using clj
/`deps.edn` you can try it out via the latest git SHA...