MYSQL - Import HTML files into a single column
I have around 1000 html files in my local computer and I have to import them into database table in a single column . I mean one full file into one cell and 1000 HTML files into 1000 rows .
CREATE TABLE `content` ( `ID` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `data` text , PRIMARY KEY (`ID`) )
one row contains ID and one html file contents
load DATA LOCAL INFILE 'C:\\Users\\userD\\Desktop\\data\\alter-data.html' INTO TABLE content LINES TERMINATED BY '</html>';
since each file end line is </html> but that didn't help to load any data ..
Can any one help me on this?
I needed to do the same thing and spent ages working it out but it turned out to be simple.
Note the test table, test_html field was defined as a "text" field
truncate table test; load data local infile 'data.htm' into table test fields terminated by '</html>' lines terminated by '</html>' (test_html);
I used the below Java program and able to upload the contents