Skip to content

Commit

Permalink
Include Instance into LOGIN7 ServerName field
Browse files Browse the repository at this point in the history
  • Loading branch information
srdan-bozovic-msft authored and kardianos committed Dec 24, 2021
1 parent 73c014a commit 5ec1570
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tds.go
Expand Up @@ -969,13 +969,20 @@ func prepareLogin(ctx context.Context, c *Connector, p msdsn.Config, logger Cont
if p.ReadOnlyIntent {
typeFlags |= fReadOnlyIntent
}
// We need to include Instance in ServerName field of LOGIN7 record
var serverName string
if len(p.Instance) > 0 {
serverName = p.Host + "\\" + p.Instance
} else {
serverName = p.Host
}
l = &login{
TDSVersion: verTDS74,
PacketSize: packetSize,
Database: p.Database,
OptionFlags2: fODBC, // to get unlimited TEXTSIZE
HostName: p.Workstation,
ServerName: p.Host,
ServerName: serverName,
AppName: p.AppName,
TypeFlags: typeFlags,
}
Expand Down

0 comments on commit 5ec1570

Please sign in to comment.