i've got a ms access mdb connected to a sql server on the internet.
whats the quickest way to get the ipaddress on the client machine from
the client machine? since there is a existing connection, shudn't there
be a simple method call that returns the ipaddress on the connection or
something?
the solutions i've seen r very ugly :(
riyazYou can get the MAC address of the client by doing this...
select net_address from master..sysprocesses where spid = @.@.spid
You then need to do processing outside of SQL Server in order to relate the
net_address to an IP address.
Tony.
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
<rmanchu@.gmail.com> wrote in message
news:1137653314.617807.262180@.g43g2000cwa.googlegroups.com...
> i've got a ms access mdb connected to a sql server on the internet.
> whats the quickest way to get the ipaddress on the client machine from
> the client machine? since there is a existing connection, shudn't there
> be a simple method call that returns the ipaddress on the connection or
> something?
> the solutions i've seen r very ugly :(
> riyaz
>|||yup i'm already getting the mac address like that. but i can't find any
clean function that relates the mac to the ipaddr. the code on the
mvp.org site returns a collection which i don't think can be related to
the mac
how can this be done?
? possible bug?
!!! i noticed the following when using access2003 over the internet to
sqlserver2000 !!!
when using my laptop with wifi, the net_address returned by
sysprocesses is INCORRECT. it returns my LAN mac_address when it shud
return my wifi mac_address since i'm connected the internet thru wifi.
can anybody duplicate this?
riyaz|||>> yup i'm already getting the mac address like that. but i can't find any
All you have to do is to use the address resolution protocol mapping. On
your command prompt, simply type in ARP -a. It should give you a table of
mapping between all MAC & IP addresses.
It is not that hard to get this information from t-SQL ( script or within a
procedure )using master..xp_cmdshell & get the IP address.
Anith|||hi.
> You can get the MAC address of the client by doing this...
> select net_address from master..sysprocesses where spid = @.@.spid
am already doing this
> You then need to do processing outside of SQL Server in order to relate th
e
> net_address to an IP address.
am working in access2003. could u give me an idea as to how i might go
about doing this?
i have 2 ip-addresses both dynamically allocated. i wud prefer a
general solution
riyaz|||I wrote this here just for you:
CREATE PROCEDURE usp_getboundAddresses
AS
BEGIN
SET NOCOUNT ON
IF OBJECT_ID('tempdb..#SomeTable') IS NULL
CREATE TABLE #SomeTable
(
ShellOutput VARCHAR(500)
)
INSERT INTO #SomeTable
EXEC xp_cmdshell 'nbtstat -a .'
SELECT
SUBSTRING( ShellOutput,
CHARINDEX('[',ShellOutput)+1,
LEN(ShellOutput) - CHARINDEX(']',ShellOutput) -2
) AS BoundAddress
from #SomeTable
WHERE ShellOutput LIKE '%Node IpAddress%' --the important lines
AND ShellOutput NOT LIKE '%0.0.0.0%' --Unassigned addresses
DROP TABLE #SomeTable
END
Returning the network adresses of the server.
HTH, Jens Suessmeyer.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment