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 .

Table structure

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

I tried

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?

Thank You

Regards

Kiran

Answers


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

http://www.roseindia.net/tutorial/java/core/files/javafilesavetodatabase.html

Thanks All

Regards

Kiran


Need Your Help

How to construct graph in graphx

scala graph apache-spark scala-collections scala-2.10

I am new to scala and graphx and am having problems converting a tsv file to a graph.

how can i pause the ball when button click

android android-animation

This code gives ball moving all directions on the screen when i click on ball. My requirement is that I want to pause the ball when I click pause button ? For that where should I need to add butt...