online dating pictures photos - Iptocountry database iptocountry database error updating database error updating database

Just as an FYI, if you keep track of the IPs that hit your website, here’s some sample code The GROUP BY basically makes the ipaddr DISTINCT so this shows you where your visitors have come from for the past 24 hours.

See the demo which resolves the locations for my last 25 visitors in real time.

It also calls two procedures which prep the database for an import and then cleans up the data and indexes it.

iptocountry database iptocountry database error updating database error updating database-11iptocountry database iptocountry database error updating database error updating database-74

Inspired by kitty0’s Geo IP Demo, I created two scripts which automatically import the free Max Mind Geo IP database (which resolves IP addresses to city locations) into SQL Server using VBS and BCP.

The VBS file can be set as a Scheduled Task for Max Mind’s free once-a-month updates.

Update works the same way, you can also use the automatic update from Word Press plugin repository.

Geolocation in its most common form uses a list of IP addresses with countries assigned to each. There is a number of possible sources, after an „exahausting research“ (=running a Google search and choosing the first acceptable result) I have decided to use data from ip-to-country.webhosting.info, which have a stable download address (which allows easy updating) and an easily-parsed file: it’s a standard CSV file with 5 columns: starting IP address, ending IP address (both define an interval of addresses which belong to the same country), two-letter ISO code of the country, three-letter ISO code of the country and full ISO name of the country.

It should hopefully work with any server; however, you will need the send anything that a user could have defined to the function!

If you do not take this precaution, you give your users an ability to do anything they like with your database.

Once Lee pointed this out, I was able to create a query which query a max of 3000 distinct recs/second as opposed to 6 recs/sec! The database has been indexed as needed and queries have been optimized a ton. Creates another bcp related stored procedure which creates the necessary indexes, defrags the indexes and shrinks the database.

Without further ado, you can download the zip of import Maxmind Geo IP files here. import Max Mind Geo /* Created by Chrissy Le Maire ([email protected]) Website: ! The database is usually about the same size as the CSV (~55MB-65MB as of Jan07) - This stored proc is run each time the import Maxmind Geo file is run 4.

IPto Location(‘2.0’) as ip Location (demo) UDFs, like stored procedures, are pre-compiled and single results, after the intital compilation/first run, are returned in as little as 0milliseconds.

I’ve seen this script process 3000 hostnames a second on a dual proc Macbook (running Windows 2003/SQL 2005) with no load!

I also created a SQL Server UDF to access the data.

Tags: , ,