SQL Training Q&A - 5
Q) In connectionstrings I often see server=localhost. Where is this "localhost" name coming from? Is it in a file somewhere? Is it true that the server must be using TCP/IP for this to work? I also see server=. and server=(local) in connection strings. Do they work the same way and is there a different protocol being used or another setting?
Localhost is a name defined on every computer running TCP/IP and it maps to 127.0.0.1.
This is actually stored in the C:WINDOWSSYSTEM32DRIVERSETCHOSTS file. You do have to be using TCP/IP for localhost to be available.
"." and "(local)" are not in TCP/IP. Those are implemented in the connection string parser of the SQL Server client. Starting in ADO.NET 2.0, you can also specify the protocol using "tcp:(local)", "np:(local)" or "lpc:(local)".