PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > can't read file into a table
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
can't read file into a table

Réponse
 
LinkBack Outils de la discussion
Vieux 02/01/2008, 22h35   #1
don
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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.



  Réponse avec citation
Vieux 02/01/2008, 23h03   #2
Kees Nuyt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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)
  Réponse avec citation
Vieux 02/01/2008, 23h13   #3
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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
  Réponse avec citation
Vieux 02/01/2008, 23h39   #4
don
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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


  Réponse avec citation
Vieux 02/01/2008, 23h52   #5
don
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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




  Réponse avec citation
Vieux 03/01/2008, 01h53   #6
ZeldorBlat
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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.
  Réponse avec citation
Vieux 03/01/2008, 02h12   #7
don
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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 !



  Réponse avec citation
Vieux 03/01/2008, 08h56   #8
Luuk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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...



  Réponse avec citation
Vieux 03/01/2008, 23h28   #9
Kees Nuyt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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)
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h20.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,21611 seconds with 17 queries