Is there a difference between (local), '.' and localhost?

Chris Sutton picture Chris Sutton · Oct 1, 2008 · Viewed 9.2k times · Source

I've used all three of these when making local programmatic connections to databases. Is there any real difference between them?

Answer

Sergio Acosta picture Sergio Acosta · Oct 1, 2008

The final result is the same. The difference is:

  • 'localhost' resolves at the TCP/IP level and is equivalent to the IP address 127.0.0.1
  • Depending on the application "(local)" could be just an alias for 'localhost'. In SQLServer, '(local)' and '.' mean that the connection will be made using the named pipes (shared memory) protocol within the same machine (doesn't need to go through the TCP/IP stack).

That's the theory. In practice, I don't think there is substantial difference in performance or features if you use either one of them.