Skip to content
Snippets Groups Projects
Commit ef610cec authored by Cam Saül's avatar Cam Saül
Browse files

Allow setting instance for SQL Server DBs :yum: #1481

parent 12f05f9f
No related branches found
No related tags found
No related merge requests found
......@@ -47,13 +47,15 @@
:xml :UnknownField
(keyword "int identity") :IntegerField}) ; auto-incrementing integer (ie pk) field
(defn- connection-details->spec [details]
(defn- connection-details->spec [{:keys [instance], :as details}]
(-> (kdb/mssql details)
;; swap out Microsoft Driver details for jTDS ones
(assoc :classname "net.sourceforge.jtds.jdbc.Driver"
:subprotocol "jtds:sqlserver")
;; adjust the connection URL to match up with the jTDS format (see http://jtds.sourceforge.net/faq.html#urlFormat)
(update :subname #(s/replace % #";database=" "/"))))
;; and add the ;instance= option if applicable
(update :subname #(cond-> (s/replace % #";database=" "/")
(seq instance) (str ";instance=" instance)))))
;; See also the [jTDS SQL <-> Java types table](http://jtds.sourceforge.net/typemap.html)
(defn- date [unit field-or-value]
......@@ -114,7 +116,7 @@
(-> (sql-driver {:driver-name "SQL Server"
:details-fields [{:name "host"
:display-name "Host"
:default "localhost"}
:default "localhost"}
{:name "port"
:display-name "Port"
:type :integer
......@@ -123,6 +125,9 @@
:display-name "Database name"
:placeholder "BirdsOfTheWorld"
:required true}
{:name "instance"
:display-name "Database instance name"
:placeholder "N/A"}
{:name "user"
:display-name "Database username"
:placeholder "What username do you use to login to the database?"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment