MySQL tables emply after loading Map files w/ import script

Posts here should relate to GeoSelect only.

Moderators: Moderators, GeobytesAdmins

MySQL tables emply after loading Map files w/ import script

Postby wpriley » Fri Aug 05, 2005 12:16 am

Hi, I ran the MySqlGeoNetMapImport.sql script through phpMyAdmin on my newly greated :geobytes" MySQL database. The script found the Map .txt files and created the 8 MySQL tables but all are empty (.MYD files are 0 byes in length).

My console output is included below. Any thoughts on correcting this would be very much appreciated.

Console log:
Code: Select all
/* NOTE: Be sure that you have a database created to import into and all the map files are located in the databases data directory for example - c:/mysql/data/db_name To load the map data, just copy and paste the following in to the MySql command line. */ SELECT 'Creating Destination Tables' AS '';# Rows: 1
-- Create Tables
CREATE TABLE Subnets(
SubNetAddress varchar( 11 ) NOT NULL ,
Certainty smallint NULL ,
CityId int NULL ,
RegionId int NULL ,
CountryId int NULL ,
DmaId smallint NULL ,
RegionCertainty smallint NULL ,
CountryCertainty smallint NULL ,
PRIMARY KEY ( SubNetAddress )
);# MySQL returned an empty result set (i.e. zero rows).
CREATE TABLE Cities(
CityId int AUTO_INCREMENT NOT NULL ,
CountryID smallint NOT NULL ,
RegionID smallint NOT NULL ,
City varchar( 45 ) NOT NULL ,
Latitude float NOT NULL ,
Longitude float NOT NULL ,
TimeZone varchar( 10 ) NOT NULL ,
DmaId smallint NULL ,
County varchar( 25 ) NULL ,
Code varchar( 4 ) NULL ,
PRIMARY KEY ( CityId )
);# MySQL returned an empty result set (i.e. zero rows).
CREATE TABLE Regions(
RegionID smallint AUTO_INCREMENT NOT NULL ,
CountryID smallint NOT NULL ,
Region varchar( 45 ) NOT NULL ,
Code varchar( 8 ) NOT NULL ,
ADM1Code char( 4 ) NOT NULL ,
PRIMARY KEY ( RegionID )
);# MySQL returned an empty result set (i.e. zero rows).
CREATE TABLE Countries(
CountryId smallint AUTO_INCREMENT NOT NULL ,
Country varchar( 50 ) NOT NULL ,
FIPS104 varchar( 2 ) NOT NULL ,
ISO2 varchar( 2 ) NOT NULL ,
ISO3 varchar( 3 ) NOT NULL ,
ISON varchar( 4 ) NOT NULL ,
Internet varchar( 2 ) NOT NULL ,
Capital varchar( 25 ) NULL ,
MapReference varchar( 50 ) NULL ,
NationalitySingular varchar( 35 ) NULL ,
NationalityPlural varchar( 35 ) NULL ,
Currency varchar( 30 ) NULL ,
CurrencyCode varchar( 3 ) NULL ,
Population bigint NULL ,
Title varchar( 50 ) NULL ,
COMMENT varchar( 255 ) NULL ,
PRIMARY KEY ( CountryId )
);# MySQL returned an empty result set (i.e. zero rows).
CREATE TABLE Dmas(
DmaId smallint NOT NULL ,
CountryId smallint NULL ,
DMA varchar( 3 ) NULL ,
Market varchar( 50 ) NULL
);# MySQL returned an empty result set (i.e. zero rows).
CREATE TABLE ProxyNetworks(
SubnetAddress varchar( 11 ) NULL ,
Network varchar( 50 ) NULL ,
CityId int NULL
);# MySQL returned an empty result set (i.e. zero rows).
CREATE TABLE PrivateAddresses(
AddressPrefix varchar( 11 ) NOT NULL ,
PRIMARY KEY ( AddressPrefix )
);# MySQL returned an empty result set (i.e. zero rows).
CREATE TABLE Nbc(
PrimaryCityId int NOT NULL ,
CityId int NOT NULL ,
Distance smallint NULL
);# MySQL returned an empty result set (i.e. zero rows).
SELECT 'Loading Data Files Please Wait ...' AS '';# Rows: 1
-- Load Data From Flat Files
LOAD DATA INFILE 'Subnets.txt' INTO TABLE Subnets FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'Cities.txt' INTO TABLE Cities FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'Regions.txt' INTO TABLE Regions FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'Countries.txt' INTO TABLE Countries FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'Dmas.txt' INTO TABLE Dmas FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'ProxyNetworks.txt' INTO TABLE ProxyNetworks FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'PrivateAddresses.txt' INTO TABLE PrivateAddresses FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'Nbc.txt' INTO TABLE Nbc FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
Pat Riley
wpriley
 
Posts: 6
Joined: Thu Aug 04, 2005 11:58 pm
Location: Albuquerque, NM, USA

Postby Russell » Fri Aug 05, 2005 3:32 am

Could you please verify that the tables are empty by running, one at a time, the following queries.
Code: Select all
SELECT count(*) as subnets FROM Subnets;
SELECT count(*) as Cities FROM Cities;
SELECT count(*) as Regions FROM Regions;
SELECT count(*) as Countries FROM Countries;
SELECT count(*) as Dmas FROM Dmas;
SELECT count(*) as ProxyNetworks FROM ProxyNetworks;
SELECT count(*) as PrivateAddresses FROM PrivateAddresses;
SELECT count(*) as Nbc FROM Nbc;


Now, I will assume that the database is indeed empty. First thing to check would be that you copy the text files into your the mysql database directory. In my case, running MySql 4.1 nt, this is:
Code: Select all
C:\\Program Files\\MySQL\\MySQL Server 4.1\\data\\geonetmap


Then run:
Code: Select all
/* NOTE: Be sure that you have a database created to import into
   and all the map files are located in the databases data directory
   for example - c:/mysql/data/db_name

   To load the map data, just copy and paste the following in to
   the MySql command line.
*/
select 'Truncating Destination Tables' as '';
-- Delete Data From All Tables
truncate table Subnets;
truncate table Cities;
truncate table Regions;
truncate table Countries;
truncate table Dmas;
truncate table ProxyNetworks;
truncate table PrivateAddresses;
truncate table Nbc;

/*
Some versions of MySql do not support truncate table commands, so there are delete commands included
below.
*/

delete From Subnets;
delete From Cities;
delete From Regions;
delete From Countries;
delete From Dmas;
delete From ProxyNetworks;
delete From PrivateAddresses;
delete From Nbc;

select 'Loading Data Files Please Wait ...' as '';
-- Load Data From Flat Files
LOAD DATA INFILE 'Subnets.txt' INTO TABLE Subnets
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\r\\n' IGNORE 1 LINES;

LOAD DATA INFILE 'Cities.txt' INTO TABLE Cities
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\r\\n' IGNORE 1 LINES;

LOAD DATA INFILE 'Regions.txt' INTO TABLE Regions
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\r\\n' IGNORE 1 LINES;

LOAD DATA INFILE 'Countries.txt' INTO TABLE Countries
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\r\\n' IGNORE 1 LINES;

LOAD DATA INFILE 'Dmas.txt' INTO TABLE Dmas
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\r\\n' IGNORE 1 LINES;

LOAD DATA INFILE 'ProxyNetworks.txt' INTO TABLE ProxyNetworks
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\r\\n' IGNORE 1 LINES;

LOAD DATA INFILE 'PrivateAddresses.txt' INTO TABLE PrivateAddresses
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\r\\n' IGNORE 1 LINES;

LOAD DATA INFILE 'Nbc.txt' INTO TABLE Nbc
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\r\\n' IGNORE 1 LINES;
Russell
Image it's the end of spam...
http://m.geobytes.com/
<geoselect><geoif geodefault>Special Welcome to folks from <geobytes city>, <geobytes country>.</geoif></geoselect>
User avatar
Russell
Moderator
 
Posts: 368
Joined: Mon Dec 08, 2003 9:05 am
Location: Brisbane, Australia

Didn't work...

Postby wpriley » Fri Aug 05, 2005 5:15 am

Hi Russell, thanks for your help. I did the following:
1) Ran the 8 individual queries. All 8 tables are indeed empty (0 records).
2) Confirmed that the 8 Map .txt files were in my MySQL directory. They are.
3) Ran the provided script. It took a while to run making me think it was loadding table but all 8 again came back empty. (The .MYD files are all 0 byes long, the .MYI files are all 1.00KB long, and the .frm files vary slightly in length but are ~8.50KB in size.)

Thanks for you continued support. Here's the console output from your last script:

/* NOTE: Be sure that you have a database created to import into and all the map files are located in the databases data directory for example - c:/mysql/data/db_name To load the map data, just copy and paste the following in to the MySql command line. */ SELECT 'Truncating Destination Tables' AS '';# Rows: 1
-- Delete Data From All Tables
TRUNCATE TABLE Subnets;# MySQL returned an empty result set (i.e. zero rows).
TRUNCATE TABLE Cities;# MySQL returned an empty result set (i.e. zero rows).
TRUNCATE TABLE Regions;# MySQL returned an empty result set (i.e. zero rows).
TRUNCATE TABLE Countries;# MySQL returned an empty result set (i.e. zero rows).
TRUNCATE TABLE Dmas;# MySQL returned an empty result set (i.e. zero rows).
TRUNCATE TABLE ProxyNetworks;# MySQL returned an empty result set (i.e. zero rows).
TRUNCATE TABLE PrivateAddresses;# MySQL returned an empty result set (i.e. zero rows).
TRUNCATE TABLE Nbc;# MySQL returned an empty result set (i.e. zero rows).
/* Some versions of MySql do not support truncate table commands, so there are delete commands included below. */ DELETE FROM Subnets;# MySQL returned an empty result set (i.e. zero rows).
DELETE FROM Cities;# MySQL returned an empty result set (i.e. zero rows).
DELETE FROM Regions;# MySQL returned an empty result set (i.e. zero rows).
DELETE FROM Countries;# MySQL returned an empty result set (i.e. zero rows).
DELETE FROM Dmas;# MySQL returned an empty result set (i.e. zero rows).
DELETE FROM ProxyNetworks;# MySQL returned an empty result set (i.e. zero rows).
DELETE FROM PrivateAddresses;# MySQL returned an empty result set (i.e. zero rows).
DELETE FROM Nbc;# MySQL returned an empty result set (i.e. zero rows).
SELECT 'Loading Data Files Please Wait ...' AS '';# Rows: 1
-- Load Data From Flat Files
LOAD DATA INFILE 'Subnets.txt' INTO TABLE Subnets FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'Cities.txt' INTO TABLE Cities FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'Regions.txt' INTO TABLE Regions FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'Countries.txt' INTO TABLE Countries FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'Dmas.txt' INTO TABLE Dmas FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'ProxyNetworks.txt' INTO TABLE ProxyNetworks FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'PrivateAddresses.txt' INTO TABLE PrivateAddresses FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
LOAD DATA INFILE 'Nbc.txt' INTO TABLE Nbc FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ;# MySQL returned an empty result set (i.e. zero rows).
Pat Riley
wpriley
 
Posts: 6
Joined: Thu Aug 04, 2005 11:58 pm
Location: Albuquerque, NM, USA

Postby Adrian » Fri Aug 05, 2005 6:06 am

Hi Pat,
Just two thoughts...
1. It may be worth specifying the full path to the data files in your LOAD DATA command - perhaps it is looking in a different directory for the files?
2. It may be worth trying the command with TERMINATED BY '\\n' rather then TERMINATED BY '\\r\\n' as the extra carriage return that is required by windows is sometimes stripped out when transferring the file to Unix. For example if you ftp the file up as text then the extra carriage return will be removed. (If you transferred the file up as part of an archive and then extracted it, then it probably would not be.)

You may find the info in this post useful http://forums.geobytes.com/viewtopic.php?p=945#945

If none of that works, then I would try setting up a small test file containing a single line of data - possibly something straight out of a MySql tutorial. This would confirm that we definitely have the correct directory and required permissions etc.

In any case, please let me know if I can assist further.
Last edited by Adrian on Tue Oct 31, 2006 3:01 pm, edited 1 time in total.
Adrian
“The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt.” - Bertrand Russell
--
Have you tried the Local Search facility on the IP Locator Page yet?
User avatar
Adrian
Moderator
 
Posts: 840
Joined: Thu Nov 20, 2003 9:58 am

Problem fixed!!! Thanks...

Postby wpriley » Fri Aug 05, 2005 6:51 pm

Hi Adrian,
Changing the script to "TERMINATED BY '\\n'" rather then "TERMINATED BY '\\r\\n'" solved the problem.

Thanks very much!
Pat Riley
wpriley
 
Posts: 6
Joined: Thu Aug 04, 2005 11:58 pm
Location: Albuquerque, NM, USA

Opps, still NOT solved.

Postby wpriley » Fri Aug 05, 2005 7:20 pm

Hi Adrian,

I thought the empty tables issue was solved when I saw my console output (after removing the "\r" but when looking at the tables themselves, all the .MYD files are still 0 bytes in length.

My console log (pasted below) shows "Affected row" counts equal to the line count minus one in each of the tables (except Subnets which was one record short ... 1,808,313 instead of 1,808,314).

Obviously this indicates that the script is pathing correctly to the .txt files and that each line is being processed. The tables, though, aren't getting loaded.

Any additional thoughs would be appreciated. Thanks,
Pat Riley

Below is the console output:

LOAD DATA INFILE '/usr/local/mysql/var/geobytes/Subnets.txt' INTO TABLE Subnets FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES ;# Affected rows:1808313
LOAD DATA INFILE '/usr/local/mysql/var/geobytes/Cities.txt' INTO TABLE Cities FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES ;# Affected rows:36565
LOAD DATA INFILE '/usr/local/mysql/var/geobytes/Regions.txt' INTO TABLE Regions FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES ;# Affected rows:3953
LOAD DATA INFILE '/usr/local/mysql/var/geobytes/Countries.txt' INTO TABLE Countries FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES ;# Affected rows:275
LOAD DATA INFILE '/usr/local/mysql/var/geobytes/Dmas.txt' INTO TABLE Dmas FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES ;# Affected rows:210
LOAD DATA INFILE '/usr/local/mysql/var/geobytes/ProxyNetworks.txt' INTO TABLE ProxyNetworks FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES ;# Affected rows:17473
LOAD DATA INFILE '/usr/local/mysql/var/geobytes/PrivateAddresses.txt' INTO TABLE PrivateAddresses FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES ;# Affected rows:51
LOAD DATA INFILE '/usr/local/mysql/var/geobytes/Nbc.txt' INTO TABLE Nbc FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES ;# Affected rows:2946725
Pat Riley
wpriley
 
Posts: 6
Joined: Thu Aug 04, 2005 11:58 pm
Location: Albuquerque, NM, USA

Re: Opps, still NOT solved.

Postby Adrian » Fri Aug 05, 2005 10:42 pm

wpriley wrote:Obviously this indicates that the script is pathing correctly to the .txt files and that each line is being processed. The tables, though, aren't getting loaded.
Now that is weird - I am going to have think about that one.
Adrian
“The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt.” - Bertrand Russell
--
Have you tried the Local Search facility on the IP Locator Page yet?
User avatar
Adrian
Moderator
 
Posts: 840
Joined: Thu Nov 20, 2003 9:58 am

Re: Opps, still NOT solved.

Postby Russell » Tue Aug 09, 2005 4:12 pm

wpriley wrote:My console log (pasted below) shows "Affected row" counts equal to the line count minus one in each of the tables (except Subnets which was one record short ... 1,808,313 instead of 1,808,314).
This is correct, that is due to the table field names listed on row 0 (first line) - the other row will be a \r\n on its own line. 1,808,313 is the correct number of records for that weeks' subnets' data file - a history can be found at http://www.geobytes.com/UpdateHistory2005.htm. Could you please reconfirm that the table counts are still 0 as looking at the logs you sent the "# Affected rows:" messages look to be in order - my guess now is that your data is there.

I also forgot to mention to make sure to select the appropriate database before running the table count queries. You said earlier you used a database named "geobytes". Simply execute
Code: Select all
use geobytes;
before running the table count queries
Code: Select all
SELECT count(*) as subnets FROM Subnets;
SELECT count(*) as Cities FROM Cities;
SELECT count(*) as Regions FROM Regions;
SELECT count(*) as Countries FROM Countries;
SELECT count(*) as Dmas FROM Dmas;
SELECT count(*) as ProxyNetworks FROM ProxyNetworks;
SELECT count(*) as PrivateAddresses FROM PrivateAddresses;
SELECT count(*) as Nbc FROM Nbc;


wpriley wrote:when looking at the tables themselves, all the .MYD files are still 0 bytes in length.
It is possible that your MySql server is storing the data in InnoDb tables, in which case, would be storing all the data in a file such as "ibdata1" in the "data" directory and not .MYD files. Could you provide some details on your MySql setup? Things like the MySql version, your servers' OS and what engine the tables' data are stored in.

Table information can be gathered by running the SQL
Code: Select all
show table status from `geobytes`;

I would not be too worried (at the moment) if the .MYD files are 0 bytes - as long as all of the data made it there and you can query the tables. The count * from table queries can confirm both of these - provided your tables have acceptable rowcounts.
Russell
Image it's the end of spam...
http://m.geobytes.com/
<geoselect><geoif geodefault>Special Welcome to folks from <geobytes city>, <geobytes country>.</geoif></geoselect>
User avatar
Russell
Moderator
 
Posts: 368
Joined: Mon Dec 08, 2003 9:05 am
Location: Brisbane, Australia

Postby Russell » Sat Aug 13, 2005 12:47 pm

Could you please reconfirm that the tables are still empty? Let me or another moderator know if you require further assistance.
Russell
Image it's the end of spam...
http://m.geobytes.com/
<geoselect><geoif geodefault>Special Welcome to folks from <geobytes city>, <geobytes country>.</geoif></geoselect>
User avatar
Russell
Moderator
 
Posts: 368
Joined: Mon Dec 08, 2003 9:05 am
Location: Brisbane, Australia

Postby wpriley » Sat Aug 13, 2005 8:03 pm

Hi Russell, no (unfortunately) all eight tables still contain 0 records. I confirmed this both by running the following:

use geobytes;
SELECT count(*) as Subnets FROM Subnets;

Which reports 0 (as does the count on the other seven tables) and by examining the "geobytes" database in phpMyAdmin which shows 0 records in each of the eight tables.

Per your suggestion, I checked the "geobytes" MySQL database directory to see if the script ouput was stored in InnoDb (or any other files). There's nothing in the directory except the original eight .TXT import files and a .MYD (0 bytes long), .MYI and .FRM file for each of the eight tables (these 24 files were successfully created by your import script).

Per your request, here is my basic server environment:

Operating System: Redhat Linux
Kernel Version: 2.4.25
Apache/PHP Version: Apache/1.3.33 (Unix) PHP/4.3.11
Perl Version: v5.6.0
MySQL Version: 3.23.33

Please advise if anymore detail is need.

Thanks for your interest and continued support. I'd be very appreciative of any additional suggestions.
Pat Riley
wpriley
 
Posts: 6
Joined: Thu Aug 04, 2005 11:58 pm
Location: Albuquerque, NM, USA

Postby Adrian » Sun Aug 14, 2005 3:53 am

Hi wpriley,

Could you possibly setup a small test file containing a single line of data - possibly something straight out of a MySql tutorial. Import that using the equivalent "LOAD DATA INFILE" command from the tutorial, and then see if that data is retained? For the test to be valid, your would also need to confirm that the file permissions where the same on both the test source file and the geo-data files.

(There are some sample "LOAD DATA INFILE" commands in the MySql documentation at http://dev.mysql.com/doc/mysql/en/load-data.html but I did find any that were really clear-cut. This example looked better http://sunsite.mff.cuni.cz/MIRRORS/ftp. ... ables.html but you may know of a better one.)

If you can get one of these samples to work, then I would look at what the difference is between the structures of the data, and also the "LOAD DATA INFILE" commands. In any case, you may like to post the first two rows of your countries data file here so that I can "test import" it here. (This may be pointless though, as any non visible characters such as tabs would be lost.)

Finally, it is probably not an issue, but i noticed that you are using MySQL Version: 3.23.33 and I am using Version: 4.1.7-nt Perhaps there is a difference, but I think that is unlikely or we would have had others report this problem earlier. On the other hand, perhaps the people that running these earlier version know that they need to change something and are making the change without reporting it back to us. - I will try to research this angle a little more and get back to you if I discover anything.

In any case, please let me know if I can assist further.
Adrian
“The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt.” - Bertrand Russell
--
Have you tried the Local Search facility on the IP Locator Page yet?
User avatar
Adrian
Moderator
 
Posts: 840
Joined: Thu Nov 20, 2003 9:58 am

Problem solved!!!

Postby wpriley » Sun Aug 14, 2005 6:47 am

Adrian, going to your example page proved to be a good idea. In examining their sample syntax versus your script, I noticed they added the word "LOCAL" into the "LOAD DATA INFILE" instruction resulting in "LOAD DATA LOCAL INFILE". I changed the eight load data lines in your script similarly and all tables LOADED PERFECTLY.

Thanks for all your help.

Below are the revised script lines including the change I mentioned in an earlier post to the line terminator from '\\r\\n' to '\\n':

-- Load Data From Flat Files
LOAD DATA LOCAL INFILE '/usr/local/mysql/var/geobytes/Subnets.txt' INTO TABLE Subnets
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\n' IGNORE 1 LINES;

LOAD DATA LOCAL INFILE '/usr/local/mysql/var/geobytes/Cities.txt' INTO TABLE Cities
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\n' IGNORE 1 LINES;

LOAD DATA LOCAL INFILE '/usr/local/mysql/var/geobytes/Regions.txt' INTO TABLE Regions
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\n' IGNORE 1 LINES;

LOAD DATA LOCAL INFILE '/usr/local/mysql/var/geobytes/Countries.txt' INTO TABLE Countries
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\n' IGNORE 1 LINES;

LOAD DATA LOCAL INFILE '/usr/local/mysql/var/geobytes/Dmas.txt' INTO TABLE Dmas
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\n' IGNORE 1 LINES;

LOAD DATA LOCAL INFILE '/usr/local/mysql/var/geobytes/ProxyNetworks.txt' INTO TABLE ProxyNetworks
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\n' IGNORE 1 LINES;

LOAD DATA LOCAL INFILE '/usr/local/mysql/var/geobytes/PrivateAddresses.txt' INTO TABLE PrivateAddresses
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\n' IGNORE 1 LINES;

LOAD DATA LOCAL INFILE '/usr/local/mysql/var/geobytes/Nbc.txt' INTO TABLE Nbc
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\\n' IGNORE 1 LINES;
Pat Riley
wpriley
 
Posts: 6
Joined: Thu Aug 04, 2005 11:58 pm
Location: Albuquerque, NM, USA

Postby Russell » Sun Aug 14, 2005 3:08 pm

Thanks for the update. Great to hear it worked. I will take a look at testing using this way on our environments and updating our scripts.
Russell
Image it's the end of spam...
http://m.geobytes.com/
<geoselect><geoif geodefault>Special Welcome to folks from <geobytes city>, <geobytes country>.</geoif></geoselect>
User avatar
Russell
Moderator
 
Posts: 368
Joined: Mon Dec 08, 2003 9:05 am
Location: Brisbane, Australia

404 on MySqlGeoNetMapImport.sql

Postby duswil » Tue Feb 21, 2006 11:02 pm

http://epicenter.geobytes.com/MySqlGeoNetMapImport.sql is a 404. The link is from http://epicenter.geobytes.com/MySqlInstructions.htm.

Where do I get the SQL file?

Thanks,
Dusty
duswil
 
Posts: 3
Joined: Tue Feb 21, 2006 11:01 pm

Re: 404 on MySqlGeoNetMapImport.sql

Postby Adrian » Wed Feb 22, 2006 1:29 am

duswil wrote:http://epicenter.geobytes.com/MySqlGeoNetMapImport.sql is a 404. The link is from http://epicenter.geobytes.com/MySqlInstructions.htm.

Where do I get the SQL file?


Thanks for reporting this. We just moved from Windows2000 to Windows2003 and had not added .sql as a MIME type - doh!
Sorry about that.

You should find that it will work ok now.

Kind Regards
Adrian
“The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt.” - Bertrand Russell
--
Have you tried the Local Search facility on the IP Locator Page yet?
User avatar
Adrian
Moderator
 
Posts: 840
Joined: Thu Nov 20, 2003 9:58 am

Next

Return to GeoSelect

Who is online

Users browsing this forum: No registered users and 1 guest