Question

have anyone used this before, i need free country, city, IP database for sqlserver

Was it helpful?

Solution

ipinfodb provide free geolocation data for MySQL. With a simple database translator, you can put it into different database, since the table structure is simple. They also provide data in CSV format, that will be easier to imported to different database engine.

The data is based on free version of MaxMind, and it's updated every month. They also provide free API, if you don't want to store the data in your server. The accuracy is decent and enough for normal website usage.

OTHER TIPS

I have used http://www.maxmind.com/app/geolitecity . It is a less exact version of their paid database. The free database claims to be "over 99.5% on a country level and 79% on a city level for the US within a 25 mile radius". You can see their accuracy detailed at http://www.maxmind.com/app/geolite_city_accuracy.

The data is presented as a CSV file containing the starting IP block, ending IP block, and the location. It is easy enough to load into sqlserver.

APIs in C, C#, PHP, Java, Perl and the free version, GeoLite, has an IPv6 version in addition to the downloadable CSV Format.

If you need to find the location of the current user based on their IP address, then you could try the Google Geolocation API, in particular google.loader.ClientLocation.

Check out the Google API docs for more info: http://code.google.com/apis/ajax/documentation/#ClientLocation

Check this free world cities database http://www.sudostuff.com/world-cities-database-8.html

Includes city, region and country.

MySQL format file to download with three tables, country, region and City. Country schema

CREATE TABLE IF NOT EXISTS `country` (
`countryId` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`code` VARCHAR(5) DEFAULT NULL,
`name` VARCHAR(150) DEFAULT NULL,
PRIMARY KEY (`countryId`)
) ENGINE=InnoDB;

INSERT INTO `country` (`countryId`, `code`, `name`) VALUES(1, 'ad', 'andorra');
INSERT INTO `country` (`countryId`, `code`, `name`) VALUES(2, 'ae', 'united arab emirates');
INSERT INTO `country` (`countryId`, `code`, `name`) VALUES(3, 'af', 'afghanistan');
INSERT INTO `country` (`countryId`, `code`, `name`) VALUES(4, 'ag', 'antigua and barbuda');
INSERT INTO `country` (`countryId`, `code`, `name`) VALUES(5, 'ai', 'anguilla');

You can find the Mysql Database from here too...

https://github.com/baraskar/Worlds-Country-State-and-City-Mysql-Database

Suggestions always welcome...

Not exactly for SQL Server but for MySQL, I suggest, you to checkout this GitHub repository:

https://github.com/turalus/openDB

Geonames is free data but lots and lots of data. You need a DBA to cleanup the data. But it is one time effort to clean the load the data as per your requirement. I ended up with a 1.3 GB file size after zip extraction and loading this data to DB also requires a good powerful hardware.

maxmind data is very old and they have stopped updating the free data that the provide

Then there are many paid data sources but listing the least costly and good one that I used sometime back world cities database from http://www.worldcitiesdatabase.com which is at reasonable cost.

Then you can look at maxmind paid data services as well but they are very costly unless your budget is very good.

Hope this helps.

See database here -

http://myip.ms/info/cities_sql_database/World_Cities_SQL_Mysql_Database.html

They have countries / cities ddatabase for Microsoft Sql Server. Here code -

CREATE TABLE countries (
  countryID varchar(3) NOT NULL,
  countryName varchar(52) NOT NULL,
  localName varchar(45) NOT NULL,
  webCode varchar(2) NOT NULL,
  region varchar(26) NOT NULL,
  continent varchar(15) NOT NULL,
  latitude float NOT NULL,
  longitude float NOT NULL,
  surfaceArea float NOT NULL,
  population int NOT NULL,
  PRIMARY KEY (countryID),
  UNIQUE (webCode),
  UNIQUE (countryName)
);


CREATE TABLE cities (
  cityID int NOT NULL,
  cityName varchar(50) NOT NULL,
  stateID int NOT NULL,
  countryID varchar(3) NOT NULL,
  latitude float NOT NULL,
  longitude float NOT NULL,
  PRIMARY KEY (cityID),
  UNIQUE (countryID,stateID,cityID)
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top