all groups > sql server misc > april 2004 >
You're in the

sql server misc

group:

change (local) to localhost and what's the difference


change (local) to localhost and what's the difference who
4/18/2004 12:54:20 AM
sql server misc: Two questions

Once sql server has been installed how to change from (local) to
localhost or the other way arround from (local) to localhost? (currently
set (local) and want to change to localhost.

Secondly, what the hell is the difference between them. On development
machines I have installed sometimes localhost will not work but (local)
will. This is the case even when the hosts (<win>/system32/drivers/etc)
file has an entry like the following

127.0.0.1 localhost


Seems very confusing to have two different ways to refer the 'local
machine'

???
Re: change (local) to localhost and what's the difference Tibor Karaszi
4/18/2004 7:04:12 PM
(local) is resolved by the SQL Server netlib and uses whatever network protocol you have configured in Client
Network Utility. The netlib does not understand localhost, so it passes this to the IP stack which resolves
it. In the cases where localhost doesn't work, you probably didn't configure the client to use the TCP/IP
Netlib.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp


[quoted text, click to view]

Re: change (local) to localhost and what's the difference who
4/18/2004 7:22:56 PM
Thanks Tibor for the reply. I thought about that and checked with the network utility and it reported that I had
'named pipes' and TCP/IP. The properties under TCP/IP said that I was using port 1433. Still the connection to
localhost did not work. Is there another step that I'm missing somewhere??

Here's some more things I did but don't really understand the outcome except that isql and osql get at the
database differently,

ping localhost WORKS FINE

connectionString = "server=localhost;uid=sa;pwd=;database=pubs;"
FAILS
connectionString= "server=(local);uid=sa;pwd=;database=pubs;"
WORKS

C:\>osql -U sa -S localhost FAILS
Password:
[DBNETLIB]General network error. Check your network documentation.
[DBNETLIB]ConnectionRead (recv()).

C:\>isql -U sa -S localhost WORKS
Password:
1>

[quoted text, click to view]
Re: change (local) to localhost and what's the difference who
4/18/2004 9:58:47 PM


[quoted text, click to view]

They are one and the same. This is my development machine. I doing ASP.NET
development. The Sql Server is local.


[quoted text, click to view]

Server

[quoted text, click to view]

named pipes was at the top then TCP/IP


[quoted text, click to view]
Re: change (local) to localhost and what's the difference Tibor Karaszi
4/18/2004 10:29:15 PM
Did you check on the client or server machine? Also, did you use Client or Server network utility? And, which
of the netlibs were at the top if you checked on the client machine using client network utility?

I really can't say why ISQL work using the word localhost. My guess is that there is code inside ISQL that
changes "localhost" to "(local)" so that when this arrives to the netlib, it receives "(local)". But as I
don't have the source code available for ISQL, I can't confirm that guess.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp


[quoted text, click to view]

Re: change (local) to localhost and what's the difference Tibor Karaszi
4/19/2004 9:12:11 AM
As it is the client that connects and determine which netlib to use, you need to check using *Client* Network
Utility.

--

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp

[quoted text, click to view]

AddThis Social Bookmark Button