Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An Explanation of MySqlBulkLoader

Tags:

c#

mysql

Can you tell me what MySqlBulkLoader is for, where and how to use it?

Some examples would also be appreciated, please..

like image 700
namco Avatar asked Feb 18 '11 13:02

namco


2 Answers

MySQLBulkLoader is a class in the MySQL Connector/Net class that wraps the MySQL statement LOAD DATA INFILE. This gives MySQL Connector/Net the ability to load a data file from a local or remote host to the server. [MySQLBulkLoader]

The example how to use the MySQLBulkLoader is also presented Here

To be clear: The MySQLBulkLoader is not similar to SQLBulkCopy. SQLBulkCopy also called Bulk insert reads data from DataTable and MySQLBulkLoader also called LOAD DATA INFILE reads from a file. If you have a list of data to insert in you database, it is possible to prepare and insert data inside you database directly with SQLBulkCopy; where with the MySQLBulkoader you will need to genereate a file from your data before running the command.

There are no counterpart of SQLBulkCopy inside MySQL Connector/Net at the time writting; however, the MySQL DB support Bulk insert, so you can run the corresponding command in a MySQLCommand like presented Here.

like image 172
Samuel L Avatar answered Oct 02 '22 14:10

Samuel L


MySqlBulkLoader is a class provided by the MySql .net Connector.

It provides an interface to MySql that is similar in concept to the SqlBulkCopy class / BCP for Sql Server. Basically, it allows you to load data into MySql in bulk. A decent looking example can be found at dragthor.wordpress.com and there's also an example in the MySql documentation.

like image 35
Rob Avatar answered Oct 02 '22 13:10

Rob