How to bulk load data into mysql database

Published on Author bloggerfiveLeave a comment

In MySQL Connector,bulk loading of large amount data into table is achieved through  MysqlBulkLoader class.

  • The data’s could be txt or csv files with tab delimiters .
  • It is very speedy way of  inserting data.

That loader class provides the  following  mysql statement .

Example 1:

MySqlConnection connection = new MySqlConnection(conString);

MySqlBulkLoader loader = new MySqlBulkLoader(connnection);

loader.TableName = “Student”;

loader.FieldTerminator = “\t”;

loader.LineTerminator = “\n”;

loader.FileName = “d:/student_data.txt”;

int insertedCount = loader.load();

Example 2 :

The MySQLBulkloader class internally loads data files from local or remote system into INFILE.And then pushes loaded data’s into table .

 LOAD DATA LOCAL INFILE ‘fileName.txt’ INTO TABLE tableName;




Leave a Reply

Your email address will not be published. Required fields are marked *