How do I use MaxMind's GeoIP database to determine location?

倖福魔咒の 提交于 2019-12-20 05:47:07

问题


So, I was told in my previous question that I can use the databases provided by MaxMind to determine locations.

So, I got their databases downloaded from their site. They are csv files and open up in Excel.

InetAddress ip = InetAddress.getLocalHost() is how I get the IP of my computer. From there I do String justIP = ip.getHostAddress()

My question is:

  • How do I resolve justIP to a city location using the DB I just downloaded ???

  • I am new to this so a little help will be appreciated.

    One of the files has three columns. startIPNum, endIPNum and locID I do not know what these do but I guess locID maps to a city and country location in the other file.


    回答1:


    Did you tried the Java examples from Maxmind? http://dev.maxmind.com/geoip/downloadable#Java-8
    And see http://dev.maxmind.com/geoip/csv for field descriptions



    来源:https://stackoverflow.com/questions/14746169/how-do-i-use-maxminds-geoip-database-to-determine-location

    易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
    该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!