Results 1 to 3 of 3

Thread: Import txt file to mysql

  1. #1
    Join Date
    Jan 2009
    Posts
    70

    Import txt file to mysql

    Hello,

    I try to import a text file containing data to a mysql table. In this text file fields are separated by a '*' for example, and records are separated by a '/'.

    I want an example of source code in Java to help me with this task.
    thank you

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: Import txt file to mysql

    SQLDeveloper must you be able to do that, at worst before replacing * by your and your / by carriage returns. But if you want to do in java, learn how to read the file in java, the faq to see how we send the sql in java, and between the two you use the method maString . for cutting split stereo (which avoids the string does not return empty elements).
    Or you play a little more carefully reading the file in chunks to meet "/". It depends on the volume.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Import txt file to mysql

    yes if MySQL has been setup with the option data local in file

    Code:
    row_1_test1 * row_1_test2 * row_1_test3 / row_2_test1 * row_2_test2 * row_2_test3
    Code:
    % $ Sed \
    -e "s /*/;/ g" \
    -e "s / \ / / \ \ n / g 'test.txt | tr' \ \ n '' \ n '

    Code:
    row_1_test1; row_1_test2; row_1_test3
    row_2_test1; row_2_test2; row_2_test3
    # (C) a small trick by moving BSD / Non-GNU / Non-minix and line feed (CR / LF). enjoy!
    a note that regexps are row_1_-simple / * test3 and it is shit, but hey, it's a starting point

Similar Threads

  1. mysql config file in MySQL
    By Netorious in forum Software Development
    Replies: 4
    Last Post: 18-03-2010, 09:43 PM
  2. Navicat : Import Data into MySQL
    By Martien in forum Windows Software
    Replies: 4
    Last Post: 22-01-2010, 12:56 PM
  3. Import sql file in mysql
    By Zool in forum Software Development
    Replies: 3
    Last Post: 18-11-2009, 11:34 AM
  4. Replies: 3
    Last Post: 07-11-2009, 09:36 PM
  5. How to import mysql database into sharepoint
    By RasMus in forum Windows Software
    Replies: 3
    Last Post: 11-06-2009, 01:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,691,780.30217 seconds with 16 queries