Announcement

Announcement Module
Collapse
No announcement yet.

how to give path of the file in load data file syntax

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to give path of the file in load data file syntax

    Hi All,


    can anyone please tell me how i can provide the path of the file(from which i want to load data) in load data infile syntax.

    I m using mysql on linux platform and made a querry as follows.

    LOAD DATA INFILE "MyFile" INTO TABLE TB_MRR FIELDS TERMINATED BY ',' IGNORE 1 LINES (NodeName, RecordId, resolution, opc, OrigRsId, origRsName, dpc, DestRsId, destRsName, finalDpc, finalRsId, finalRsName, si, gttDone, icLsId, icLsName, ogLsId, ogLsName, icNumSifOct, ogNumSifOct, icSsn, icGtDigits, icGtFrmt, icTT, ogSsn, ogGtDigits, ogGtFrmt, ogTT, isMsgSnt, msgTypeRx, msgTypeTx, svcMsgType);

    executing above caommand gives the error as below.
    ERROR 1105 (HY000): File '/var/lib/mysql/m7db/MyFile' not found (Errcode: 2)

  • #2
    input an absolute or relative pathname before a filename.

    here is an example.

    LOAD DATA INFILE "/MyPath/MyFile" INTO TABLE TB_MRR FIELDS TERMINATED BY ',' IGNORE 1 LINES (NodeName, RecordId, resolution, opc, OrigRsId, origRsName, dpc, DestRsId, destRsName, finalDpc, finalRsId, finalRsName, si, gttDone, icLsId, icLsName, ogLsId, ogLsName, icNumSifOct, ogNumSifOct, icSsn, icGtDigits, icGtFrmt, icTT, ogSsn, ogGtDigits, ogGtFrmt, ogTT, isMsgSnt, msgTypeRx, msgTypeTx, svcMsgType);

    it's simple.

    Comment


    • #3
      thank you so much sweet .

      i tried as u suggested it works fine when i m giving the command within mysql> LOAD........ .but actually i m trying the same comand using mysql_query(query_string)function,where query_string contains the same command as above.
      In that case an error message is raised :
      ERROR: Error while querying database insertion - File '/Mypath/MyFile
      ' not found (Errcode: 2).

      Comment

      Working...
      X