patternsqlMinor
"When specifying a local instance, always use (local)" -- why?
Viewed 0 times
specifyinglocalwhyalwaysinstancewhenuse
Problem
On the subject of SQL Server connection strings, Microsoft says:
When specifying a local instance, always use (local).
The implication is that using
When specifying a local instance, always use (local).
The implication is that using
localhost is a bad idea. But why? Or am I reading too much into the wording?Solution
This is from memory and without reference so my recall may not be accurate.
IIRC for 2005+ "(local)", "localhost" and "." are equivalent and will use the Shared Memory protocol. Prior to 2005, "(local)" and "." would use Shared Memory whereas localhost would not necessarily do so by default. Use of machine name or FQDN could result in a DNS lookup so is not recommended for a local machine connection.
Lastly, the "(local)" term (including brackets) is a special keyword, rather than a reference to the local machine.
IIRC for 2005+ "(local)", "localhost" and "." are equivalent and will use the Shared Memory protocol. Prior to 2005, "(local)" and "." would use Shared Memory whereas localhost would not necessarily do so by default. Use of machine name or FQDN could result in a DNS lookup so is not recommended for a local machine connection.
Lastly, the "(local)" term (including brackets) is a special keyword, rather than a reference to the local machine.
Context
StackExchange Database Administrators Q#6899, answer score: 9
Revisions (0)
No revisions yet.