Re: Unsigned integer to IP address?

From: Ana C. Dent <anacedent_at_hotmail.com>
Date: Mon, 06 Oct 2003 10:32:01 -0700
Message-ID: <lGhgb.54981$Ms2.34316_at_fed1read03>


Monica Roman wrote:
> Hello everyone,
> My question is how to upload an unsigned integer so that it looks like
> an IP address in Oracle?
> A Perl program captures IP addresses from a log server and puts them
> into a .csv file that I then sqload into Oracle. When I query the db
> the numbers look very different e.g., (just an example) 2423598587
> instead of 134.290.34.59 (this was made up, any similarity to real IP
> is pure coincidence).
> I need them to look like an IP address.
>
> Thank you much,
>
> Monica

Inside the OS an IP# is just a 32-bit integer. It is typically represented in what is called "dottted-quad" notation. This means that each 8-bit byte (0-255) represents one of the 4 numbers displayed. So you need to "convert" the large decimal number into the appropriate ONE & ZERO, group them into four 8 bits bytes & the convert those four values back to decimal (Small Matter Of Programming [SMOP]). Received on Mon Oct 06 2003 - 19:32:01 CEST

Original text of this message