Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2008

Tip: Looking for answers? Try searching our database.

range of values

Thread view: 
raj - 09 Jan 2008 19:04 GMT
Hi,

The business scenaraio is i have table called rules in that rules
table i have a column (varchar()) which has the value
IP > 182.168.0.1 and IP < 182.168.0.10 .

i had witten a sql query for getting this value.so i have this value
IP > 182.168.0.1 and IP < 182.168.0.10 with me.

i need to write an expression in java such that my input value assume
to be 182.168.0.6 .

i need to find that my value lies in that range .

any one help me out thanks in advance.
derek - 09 Jan 2008 19:25 GMT
> Hi,
> The business scenaraio is i have table called rules in that rules
[quoted text clipped - 6 lines]
> i need to find that my value lies in that range .
> any one help me out thanks in advance.

Not sure exactly what you are trying to do.
I am guessing you have an ip address that you want to use in a query and see if it is between some range of ip numbers.
Instead of using a single field that is varchar, you should use two fields defined as unsigned longs.
If you store the ip address data as unsigned longs in the database, it will be simple enough then to compare it using something like

where ipnum >= iplow and ipnum <= iphigh

=====================================================
THIS IS MY SIGNATURE. There are many like it, but this one is mine.
Roedy Green - 10 Jan 2008 05:33 GMT
>where ipnum >= iplow and ipnum <= iphigh

in Java I like to write that as:

 if ( iplow <= ipnum && ipnum <= iphigh )

because it more closely mimics the mathematical notation:

 iplow <= ipnum <= iphigh
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.