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
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
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.
yes if MySQL has been setup with the option data local in file
Code:
Code:row_1_test1 * row_1_test2 * row_1_test3 / row_2_test1 * row_2_test2 * row_2_test3
% $ Sed \
-e "s /*/;/ g" \
-e "s / \ / / \ \ n / g 'test.txt | tr' \ \ n '' \ n '
Code:
# (C) a small trick by moving BSD / Non-GNU / Non-minix and line feed (CR / LF). enjoy!row_1_test1; row_1_test2; row_1_test3
row_2_test1; row_2_test2; row_2_test3
a note that regexps are row_1_-simple / * test3 and it is shit, but hey, it's a starting point
Bookmarks