seancorfield / next-jdbc

A modern low-level Clojure wrapper for JDBC-based access to databases.
https://cljdoc.org/d/com.github.seancorfield/next.jdbc/
Eclipse Public License 1.0
771 stars 91 forks source link

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

Closed se-neaxplore closed 10 months ago

se-neaxplore commented 10 months ago

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

seancorfield commented 10 months ago

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.