denisenkom / go-mssqldb

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

proposal: add support for AlwaysOn connector #423

Open GnatorX opened 6 years ago

GnatorX commented 6 years ago

Right now getInstance in tds.go only checks the first resolved address from dialer.DialContext. This means that if the AlwaysOn connector has subnets where the app can't reach, the driver will fail to create any connections. https://github.com/denisenkom/go-mssqldb/blob/master/tds.go#L58.

The solution already exist in the code in dialConnection https://github.com/denisenkom/go-mssqldb/blob/master/tds.go#L1115. This code will go through all resolution of the connector and pick one that works before proceeding. This allows the driver to work with AlwaysOn connectors with unreachable unsubnets. PR created: https://github.com/denisenkom/go-mssqldb/pull/422

kardianos commented 6 years ago

The current Get Instances function uses UDP port 1434 to port to the SQL Server Browser. This network service lists available SQL Servers and how they can be connected to.


This AlwaysOn connector appears to be describing something else. Here is how we can work on this:

GnatorX commented 6 years ago

Sorry for the late reply. I am not super familiar with AlwaysOn connector either. Let me ask some of the SQL engineers to give me some information. I will get back to you with a code proposal that is more flushed out. Thanks