seancorfield / next-jdbc

A modern low-level Clojure wrapper for JDBC-based access to databases.

Home Page:https://cljdoc.org/d/com.github.seancorfield/next.jdbc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Omit or document, default port when using mssql with a Domain/InstanceName

se-neaxplore opened this issue · comments

I had to connect to a mssql server using a Domain (instanceName) e.g. as described here:

jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]] docs

The problem is the following mssql server property:

If both a portNumber and instanceName are used, the portNumber will take precedence and the instanceName will be ignored.

I tried to connect to it providing a clojure map db-spec, which didn't work, because the default port is always added. Solution was to create the connection string myself.

This is probably out of scope for this lib, but maybe we should add this to the docs.

Context:
https://stackoverflow.com/questions/40820087/jdbc-connection-string-with-instance-name-and-domain

Per https://cljdoc.org/d/com.github.seancorfield/next.jdbc/1.3.909/doc/all-the-options you can specify :none for :port to have it omitted. Same with :host.