Вы находитесь на странице: 1из 3

Free IP2Location LITE IP-COUNTRY-REGION-CITY-L... http://lite.ip2location.com/database-ip-country-regi...

Login

HOME DATABASES FAQs CONTACT

DB9.LITE
IP2Location LITE IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE Database provides a solution
to determine the country, region or state, city, latitude and longitude, and US ZIP code of origin for any IP
address in a few simple steps. First, retrieve the IP address from the networking protocol or server-side
variable of the Web server. Next, translate the IP address to an IP number in decimal format to speed up
the database query. Lastly, reverse lookup the IP number from the IP2Location database to pinpoint the
exact geographical location.

The LITE edition is an open-source version of database with limited accuracy & number of records
compares to commercial release. It is free for personal or commercial use with attribution required by
mentioning the use of this data as follows,

This product includes IP2Location LITE data available from <a


href="http://www.ip2location.com">http://www.ip2location.com</a>.

Please get the commercial edition if you are looking for high data accuracy, more records & customer
support. Please visit product comparison page for more information.

Product Features
Features Translates IP address to country, region or state, city, latitude and longitude, and US ZIP code.

Current Version May 2014

Database Size 31.88 MB (2,075,470 Rows)

Database Format ASCII Text File (Comma Delimited) & Binary (BIN)

Database Fields
Name Type Description

ip_from INT (10) First IP address in netblock.

ip_to INT (10) Last IP address in netblock.

country_code CHAR(2) Two-character country code based on ISO 3166.

country_name VARCHAR(64) Country name based on ISO 3166.

region_name VARCHAR(128) Region or state name.

city_name VARCHAR(128) City name.

latitude DOUBLE Latitude of city.

longitude DOUBLE Longitude of city.

zip_code VARCHAR(30) ZIP/Postal code.

Set Up Database
Create SQL table

MS-SQL

CREATE DATABASE ip2location


GO

USE ip2location
GO

CREATE TABLE [ip2location].[dbo].[ip2location_db9](


[ip_from] float NOT NULL,
[ip_to] float NOT NULL,

1 de 3 07/05/14 14:47
Free IP2Location LITE IP-COUNTRY-REGION-CITY-L... http://lite.ip2location.com/database-ip-country-regi...

[country_code] nvarchar(2) NOT NULL,


[country_name] nvarchar(64) NOT NULL,
[region_name] nvarchar(128) NOT NULL,
[city_name] nvarchar(128) NOT NULL,
[latitude] float NOT NULL,
[longitude] float NOT NULL,
[zip_code] nvarchar(30) NOT NULL,
) ON [PRIMARY]
GO

CREATE INDEX [ip_from] ON [ip2location].[dbo].[ip2location_db9]([ip_from]) ON [PRIMARY]


GO

CREATE INDEX [ip_to] ON [ip2location].[dbo].[ip2location_db9]([ip_to]) ON [PRIMARY]


GO

MySQL

CREATE DATABASE ip2location;


USE ip2location;
CREATE TABLE `ip2location_db9`(
`ip_from` INT(10) UNSIGNED,
`ip_to` INT(10) UNSIGNED,
`country_code` CHAR(2),
`country_name` VARCHAR(64),
`region_name` VARCHAR(128),
`city_name` VARCHAR(128),
`latitude` DOUBLE,
`longitude` DOUBLE,
`zip_code` VARCHAR(30),
INDEX `idx_ip_from` (`ip_from`),
INDEX `idx_ip_to` (`ip_to`),
INDEX `idx_ip_from_to` (`ip_from`, `ip_to`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

PostgreSQL

CREATE DATABASE ip2location WITH ENCODING 'UTF8';


CREATE TABLE ip2location_db9(
ip_from integer(10) NOT NULL,
ip_to integer(10) NOT NULL,
country_code character(2) NOT NULL,
country_name character varying(64) NOT NULL,
region_name character varying(128) NOT NULL,
city_name character varying(128) NOT NULL,
latitude real NOT NULL,
longitude real NOT NULL,
zip_code character varying(30) NOT NULL,
ip2location_db9_pkey PRIMARY KEY (ip_from, ip_to)
);

Import the database into MS-SQL/MySQL/PostgreSQL database

MS-SQL

BULK INSERT [ip2location].[dbo].[ip2location_db9]


FROM 'C:\[path to your CSV file]\IP2LOCATION-LITE-DB9.CSV'
WITH
(
FORMATFILE = 'C:\[path to your DB9.FMT file]\DB9.FMT'
)
GO

DB9.FMT

NOTE: You will need to copy the FMT code below and save it as a le named DB9.FMT on your computer.
The rst line of the FMT code indicates the version of bcp. Please change the version as according to your MS-SQL installed.

SQL Server 2008 10.0


SQL Server 2005 9.0
SQL Server 2000 8.0

2 de 3 07/05/14 14:47
Free IP2Location LITE IP-COUNTRY-REGION-CITY-L... http://lite.ip2location.com/database-ip-country-regi...

SQL Server 7.0 7.0


SQL Server 6.5 6.5

10.0
10
1 SQLCHAR 0 1 "\"" 0 first_double_quote Latin1_General_CI_AI
2 SQLCHAR 0 20 "\",\"" 1 ip_from ""
3 SQLCHAR 0 20 "\",\"" 2 ip_to ""
4 SQLCHAR 0 2 "\",\"" 3 country_code Latin1_General_CI_AI
5 SQLCHAR 0 64 "\",\"" 4 country_name Latin1_General_CI_AI
6 SQLCHAR 0 128 "\",\"" 5 region_name Latin1_General_CI_AI
7 SQLCHAR 0 128 "\",\"" 6 city_name Latin1_General_CI_AI
8 SQLCHAR 0 20 "\",\"" 7 latitude ""
9 SQLCHAR 0 20 "\",\"" 8 longitude ""
10 SQLCHAR 0 30 "\"\r\n" 9 zip_code Latin1_General_CI_AI

MySQL

LOAD DATA LOCAL


INFILE 'IP2LOCATION-LITE-DB9.CSV'
INTO TABLE
`ip2location_db9`
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;

PostgreSQL

COPY ip2location_db9 FROM 'IP2LOCATION-LITE-DB9.CSV' WITH CSV QUOTE AS '"';

Using IP2Location BIN


Please visit IP2Location Developers and IP2Location Tutorials for details. Sample BIN databases and source codes are available for download.

Upgrade to Commercial Edition


Ready to upgrade to our commercial edition? Great! The upgrade process is easy.

1. Login to your account area.


2. Click on the Upgrade button (on the right of the package listing).
3. Select the [DB9] IP-Country-Region-City-Latitude-Longitude-ZIPCode Database and complete the payment process.
4. Once payment has been successfully completed, download DB9-IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE.CSV.ZIP from
the account area.
5. Unzip the le and import the IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE.CSV into the database.

That's all and no changes to your existing database structure, unless you are upgrading to a dierent package. Please visit IP2Location DB9 for
details.

License Agreement: General Terms and Conditions for the database licensing.

NAVIGATION FREE LITE DATABASES FEATURED SITES

Home [DB1.LITE] IP-Country IP2Location Geolocation Technology


Databases [DB3.LITE] IP-Country-Region-City IP Geolocation Web Service
FAQs [DB5.LITE] IP-Country-Region-City-Latitude-Longitude Credit Card Fraud Detection
Edition Comparison [DB9.LITE] IP-Country-Region-City-Latitude-Longitude-ZIPCode GeoDataSource World Cities
Contact [DB11.LITE] IP-Country-Region-City-Latitude-Longitude-ZIPCode-Timezone Database
LocaProxy HTTP Proxy Servers

Stay Connected

Copyright 2011-2014 IP2Location.com. All Rights Reserved. Terms of Use

3 de 3 07/05/14 14:47

Вам также может понравиться