can't read file into a table

This is a discussion on can't read file into a table within the MySQL Database forums, part of the Database Forums category; I am taking the MySQL tutor lesson http://dev.mysql.com/doc/refman/4.1/...ng-tables.html but when ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-02-2008
don
 
Posts: n/a
Default can't read file into a table

I am taking the MySQL tutor lesson
http://dev.mysql.com/doc/refman/4.1/...ng-tables.html

but when I use the command LOAD DATA LOCAL INFILE 'my path/pet.txt' INTO
TABLE pet;

I get ERROR 2 fiLE '..... ' NOT FOUND

I'm sure there is a simple solution to this, but so far Tech Support at
Network Solutions has not been able to solve it.



Reply With Quote
  #2 (permalink)  
Old 01-02-2008
Kees Nuyt
 
Posts: n/a
Default Re: can't read file into a table

On Wed, 2 Jan 2008 17:35:41 -0500, "don" <don@panix.com>
wrote:

>I am taking the MySQL tutor lesson
>http://dev.mysql.com/doc/refman/4.1/...ng-tables.html
>
>but when I use the command LOAD DATA LOCAL INFILE 'my path/pet.txt' INTO
>TABLE pet;
>
>I get ERROR 2 fiLE '..... ' NOT FOUND
>
>I'm sure there is a simple solution to this, but so far Tech Support at
>Network Solutions has not been able to solve it.


Because you asked support from Network Solutions I assume
your MySQL service is on their server and the file is on
your PC at home.
The MySQL server has to connect to you to get the file.
This in itself can be dangerous.
Therefore it has to be activated in the mysql.exe
commandline, something like:
mysql -h host -u user -ppassword --local-infile=1 database

Also, it can be blocked on the server.

http://dev.mysql.com/doc/refman/5.0/en/load-data.html
http://dev.mysql.com/doc/refman/5.0/...ata-local.html

HTH
--
( Kees
)
c[_] Once a newspaper touches a story, the facts are lost
forever, even to the protagonists. (Norman Mailer) (#344)
Reply With Quote
  #3 (permalink)  
Old 01-02-2008
Rik Wasmus
 
Posts: n/a
Default Re: can't read file into a table

On Wed, 02 Jan 2008 23:35:41 +0100, don <don@panix.com> wrote:

> I am taking the MySQL tutor lesson
> http://dev.mysql.com/doc/refman/4.1/...ng-tables.html
>
> but when I use the command LOAD DATA LOCAL INFILE 'my path/pet.txt' INTO
> TABLE pet;
>
> I get ERROR 2 fiLE '..... ' NOT FOUND
>
> I'm sure there is a simple solution to this, but so far Tech Support at
> Network Solutions has not been able to solve it.


Aside from Kees' remarks: what's the exact path of the file, the exact
path you give, and are you sure you're not giving it a relative path
that's not relative to the dir you think it would be to?
--
Rik Wasmus
Reply With Quote
  #4 (permalink)  
Old 01-02-2008
don
 
Posts: n/a
Default Re: can't read file into a table

ok sorry - I did upload the file to my home folder which is on my network
solutions space
I was told that when I log into MySQL that it would be able to read my files
on my server space but so far NOT


Reply With Quote
  #5 (permalink)  
Old 01-02-2008
don
 
Posts: n/a
Default Re: can't read file into a table

> Aside from Kees' remarks: what's the exact path of the file, the exact
> path you give, and are you sure you're not giving it a relative path
> that's not relative to the dir you think it would be to?
> --
> Rik Wasmus


Well I was told by Network Solutions to use this as my path:

http://0070353.netsolhost.com/pet.txt which is the file that I want to
load my table with

so from my computer at home, at my SecureCRT terminal, from my mysql prompt:
mysql> LOAD DATA LOCAL INFILE 'http://0070353.netsolhost.com/pet.txt' INTO
TABLE pet;

is what I type, but it never works?

I even tried changing the permissions on the file to 777

I have no trouble using mysql> INSERT INTO pet VALUES ('puffball',
'Diane', 'hammer', 'f', '1999-03-30', NULL); to fill the table
individually




Reply With Quote
  #6 (permalink)  
Old 01-03-2008
ZeldorBlat
 
Posts: n/a
Default Re: can't read file into a table

On Jan 2, 6:52 pm, "don" <d...@panix.com> wrote:
> > Aside from Kees' remarks: what's the exact path of the file, the exact
> > path you give, and are you sure you're not giving it a relative path
> > that's not relative to the dir you think it would be to?
> > --
> > Rik Wasmus

>
> Well I was told by Network Solutions to use this as my path:
>
> http://0070353.netsolhost.com/pet.txt which is the file that I want to
> load my table with
>
> so from my computer at home, at my SecureCRT terminal, from my mysql prompt:
> mysql> LOAD DATA LOCAL INFILE 'http://0070353.netsolhost.com/pet.txt'INTO
> TABLE pet;
>
> is what I type, but it never works?
>
> I even tried changing the permissions on the file to 777
>
> I have no trouble using mysql> INSERT INTO pet VALUES ('puffball',
> 'Diane', 'hammer', 'f', '1999-03-30', NULL); to fill the table
> individually


MySQL can't just go fetch a file from a URL like that. You need to
specify the local path /in the filesystem/ where the file resides.
Something like:

LOAD DATA LOCAL INFILE '/home/foo/pet.txt' INTO TABLE pet;

Unless this is some feature that I'm not aware of -- but I couldn't
find anything about it in the manual.
Reply With Quote
  #7 (permalink)  
Old 01-03-2008
don
 
Posts: n/a
Default Re: can't read file into a table


> MySQL can't just go fetch a file from a URL like that. You need to
> specify the local path /in the filesystem/ where the file resides.
> Something like:
>
> LOAD DATA LOCAL INFILE '/home/foo/pet.txt' INTO TABLE pet;
>


Thanks for looking at my problem - I have 2 MySQL accounts, one with
Panix.com and this new one with Network Solutions - In the Panix terminal
window I have no problem using this LOAD DATA..... command

for some reason Network Solutions is Fubar !



Reply With Quote
  #8 (permalink)  
Old 01-03-2008
Luuk
 
Posts: n/a
Default Re: can't read file into a table


"ZeldorBlat" <zeldorblat@gmail.com> schreef in bericht
news:18806f35-72ea-495c-ae52-fb2c4227848d@e23g2000prf.googlegroups.com...
> On Jan 2, 6:52 pm, "don" <d...@panix.com> wrote:
>> > Aside from Kees' remarks: what's the exact path of the file, the exact
>> > path you give, and are you sure you're not giving it a relative path
>> > that's not relative to the dir you think it would be to?
>> > --
>> > Rik Wasmus

>>
>> Well I was told by Network Solutions to use this as my path:
>>
>> http://0070353.netsolhost.com/pet.txt which is the file that I want to
>> load my table with
>>
>> so from my computer at home, at my SecureCRT terminal, from my mysql
>> prompt:
>> mysql> LOAD DATA LOCAL INFILE
>> 'http://0070353.netsolhost.com/pet.txt'INTO
>> TABLE pet;
>>
>> is what I type, but it never works?
>>
>> I even tried changing the permissions on the file to 777
>>
>> I have no trouble using mysql> INSERT INTO pet VALUES
>> ('puffball',
>> 'Diane', 'hammer', 'f', '1999-03-30', NULL); to fill the table
>> individually

>
> MySQL can't just go fetch a file from a URL like that. You need to
> specify the local path /in the filesystem/ where the file resides.
> Something like:
>
> LOAD DATA LOCAL INFILE '/home/foo/pet.txt' INTO TABLE pet;
>
> Unless this is some feature that I'm not aware of -- but I couldn't
> find anything about it in the manual.



try this:
from mysql-prompt
mysql> \~ pwd
/home/0070353
mysql>\LOAD DATA LOCAL INFILE '/home/0070353/pet.txt' INTO TABLE per;

In the second command-line, use the 'answer' you got from the 1st
command-line...



Reply With Quote
  #9 (permalink)  
Old 01-03-2008
Kees Nuyt
 
Posts: n/a
Default Re: can't read file into a table

On Wed, 2 Jan 2008 18:39:15 -0500, "don" <don@panix.com>
wrote:

>ok sorry - I did upload the file to my home folder which is on my network
>solutions space
>I was told that when I log into MySQL that it would be able to read my files
>on my server space but so far NOT


http://dev.mysql.com/doc/refman/5.0/en/load-data.html


If LOCAL is specified, the file is read by the client
program on the client host and sent to the server. The
file can be given as a full pathname to specify its exact
location. If given as a relative pathname, the name is
interpreted relative to the directory in which the client
program was started.

If LOCAL is not specified, the file must be located on the
server host and is read directly by the server. The server
uses the following rules to locate the file: [etc...]
--
( Kees
)
c[_] Once a newspaper touches a story, the facts are lost
forever, even to the protagonists. (Norman Mailer) (#344)
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:13 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0