go-mssqldb icon indicating copy to clipboard operation
go-mssqldb copied to clipboard

Named Instance - Not using port sets hard requirement on SQL Server Browser

Open Salatbesteck opened this issue 3 years ago • 2 comments

When working with named instances, the default mssql behavior is to use UDP on port 1434 with the SQL Server Browser to look up the port of the instance. However, when Browser Service is not running or blocked by firewall rules, no connection can be made. In other languages/drivers, this can be solved by passing the port explicitly. In this driver, even using:

sqlserver://{{username}}:{{password}}@/<Instance>?database=&port=

or

sqlserver://{{username}}:{{password}}@[:port]/<Instance>?database=

In both cases, port specification is ignored by the driver (this is expected behavior according to the docs). This way no connection with the scenario above is possible.

Salatbesteck avatar Jan 12 '22 14:01 Salatbesteck

I am also running into this same issue. The customer we are working with is blocking the use of the SQL Server Browser. We need to be able to supply both the Instance name and the port.

EnderBlue avatar Mar 02 '22 00:03 EnderBlue

this could be the first PR that goes through in the Microsoft fork

Please take a look https://github.com/microsoft/go-mssqldb/pull/6

shueybubbles avatar Apr 29 '22 19:04 shueybubbles