Uploaded image for project: 'java.jdbc'
  1. JDBC-173

Create connections for outdated Oracle SID

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Labels:

      Description

      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)

      The current clojure.jdbc implementation creates the second format, with "/" char.
      E.g.
      (def my-oracle-db {:dbtype "oracle" :dbname "dbname"...

      creates URI
      jdbc:oracle:thin:@host:port/dbname

      But this can't work with outdated SID connections.

      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

      The probable solution could looks like this:

      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))
      db-sep (if (= "sqlserver" subprotocol) ";DATABASENAME=" "/")

        Attachments

          Activity

            People

            • Assignee:
              seancorfield Sean Corfield
              Reporter:
              alex+import import
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: