Groups | Blog | Home
all groups > sql server connect > november 2003 >

sql server connect : How to get the REAL host name?


Vadim Rapp
11/20/2003 3:59:54 PM
Hello:

I need to be able to determine the name of the client machine running the
session. The value in sysprocesses.hostname is client-supplied, so it may be
not the real name of the client machine. The client can explicitly specify
any host name in the ADO connection string. Is there a way to find out the
real host name? Perhaps from the network adapter address, which is also in
sysprocesses?

This problem is especially apparent for MS Access projects (adp's); they
always connect with the host name being the name of the developer's machine.

thanks,

Vadim
Kevin
11/20/2003 5:09:27 PM
Depending on the architecture of TDS, which I'm not sure of, the MAC address
may not be the client's host NIC anyway, usually MAC address is the address
of the client NIC or the nearest router NIC whichever is logically closer on
the network.

But, it you want to assume MAC=MAC of Client NIC, you could write a routine
to parse the output of ARP -a


--
Kevin Connell, MCDBA
--------------------------------------------------
The views expressed here are my own
and not of my employer.
----------------------------------------------------
[quoted text, click to view]

Brian Moran
11/20/2003 6:26:45 PM
You tocuhed on the answer... I'm sure there's a way to get it from the MAC
address. I just don't know TCP enough to tell you how...

but there's nothing else that could definitiely tell you. As you point
out... the client can put anything it wants int he string....

--

Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com


[quoted text, click to view]

Linchi Shea
11/21/2003 12:23:37 PM
Because of the potential layers in between, whatever
solution you may use will likely be 'spotty'. There is no
sure-fire way to get the client hostname. Even if you can
get the IP address, the name that resolves to it may be
just a DNS alias.

Linchi

[quoted text, click to view]
AddThis Social Bookmark Button