denisenkom / go-mssqldb

Microsoft SQL server driver written in go language
BSD 3-Clause "New" or "Revised" License
1.82k stars 499 forks source link

No instance matching XYZ returned from the host #772

Closed adcorduneanu closed 1 year ago

adcorduneanu commented 1 year ago

I'm trying to integrate my k6 project with MSSQL, and seems there is a problem with the current setup of this implementation that's used in xk6-sql setup.

My MSSQL instance is a named instance on the current server and seems this is not accessible from the Go implementation, even that one works from anywhere else - visual studio, ssms, real apps, you name it...

I tried tampering with the connection string in all 3 formats, but nothing changed.

A screenshot proving the issue. image image image

Win OS used - v10 21H2 Go version - version go1.19.2 windows/amd64 This software version, used in xk6 - v0.12.0

Choco command to setup a similar SQL setup

choco install "sql-server-2019" -y --params='"/INSTANCENAME:SQL2012  /SkipRules:RebootRequiredCheck /IACCEPTSQLSERVERLICENSETERMS /Q /INDICATEPROGRESS /FEATURES:SQLEngine,FULLTEXT,AS,IS,BC,Conn  /SQLCOLLATION:Latin1_General_100_CI_AS /ASSERVERMODE:MULTIDIMENSIONAL /ASSYSADMINACCOUNTS:Users /ASCOLLATION:Latin1_General_100_CI_AS /FILESTREAMLEVEL:2 /FILESTREAMSHARENAME:SQL2012_Filestream /SQLMAXMEMORY:6144"'

Actual behavior Using a named instance does not work

Expected behavior Using named instances should work

Additional stuff For xk6-sql just followed the steps described here and as a code example, I followed this example.

NikitaDef commented 1 year ago

I'm trying to integrate my k6 project with MSSQL, and seems there is a problem with the current setup of this implementation that's used in xk6-sql setup.

My MSSQL instance is a named instance on the current server and seems this is not accessible from the Go implementation, even that one works from anywhere else - visual studio, ssms, real apps, you name it...

I tried tampering with the connection string in all 3 formats, but nothing changed.

A screenshot proving the issue. image image image

Win OS used - v10 21H2 Go version - version go1.19.2 windows/amd64 This software version, used in xk6 - v0.12.0

Choco command to setup a similar SQL setup

choco install "sql-server-2019" -y --params='"/INSTANCENAME:SQL2012  /SkipRules:RebootRequiredCheck /IACCEPTSQLSERVERLICENSETERMS /Q /INDICATEPROGRESS /FEATURES:SQLEngine,FULLTEXT,AS,IS,BC,Conn  /SQLCOLLATION:Latin1_General_100_CI_AS /ASSERVERMODE:MULTIDIMENSIONAL /ASSYSADMINACCOUNTS:Users /ASCOLLATION:Latin1_General_100_CI_AS /FILESTREAMLEVEL:2 /FILESTREAMSHARENAME:SQL2012_Filestream /SQLMAXMEMORY:6144"'

Actual behavior Using a named instance does not work

Expected behavior Using named instances should work

Additional stuff For xk6-sql just followed the steps described here and as a code example, I followed this example.

Hi, I guess, it depends on that code lines. https://github.com/denisenkom/go-mssqldb/blob/e53873151a46af22b77fa010fc1485c31cbb38b1/tds.go#L1054

Remove port in connection string.

adcorduneanu commented 1 year ago

Hi @NikitaDef,

Thank you for your help.

I will close the issue as this one is fixed - for me, at least.

To provide some insights for those who might encounter the same issue - this was not a server setup, but a development computer, and until now I didn't require my SQL server to be exposed over TCP.

After the modification of the TCP configuration, and a computer restarts it worked, as this didn't work with only service restart. image

What it's weird is the fact that even if it's local, and any other client connects, this one doesn't as it treats it as a remote, even isn't.