Hi all,
we’re facing the following problem: we want to load huge amount of datas into a MySQL db, and to do so we’re trying to use a library we’ve developed in the past (and that it’s still working perfectly in other currently running codes outside Wisej) based on MySqlBulkLoader (https://dev.mysql.com/doc/dev/connector-net/8.0/html/T_MySql_Data_MySqlClient_MySqlBulkLoader.htm); unfortunately, every time we try to call it inside a Wisej-based application the result is the following:
MySql.Data.MySqlClient.MySqlException
The MySQL server is running with the –secure-file-priv option so it cannot execute this statement
It’s not an issue of our MySQL server, since as I said previously the same line of codes running on another .exe are working perfectly; maybe a configuration to be set up on Wisej side? Below the code:
using (var connection = new MySqlConnection(connectionString)){
connection.Open();
// Lines of code for preparing the .csv file to be loaded…
var msbl = new MySqlBulkLoader(connection);
msbl.Local = true;
msbl.TableName = NameOfTable;
msbl.FileName = CsvFile;
msbl.FieldTerminator = “;”;
msbl.LineTerminator = “\r\n”;
msbl.NumberOfLinesToSkip = 1;
msbl.FieldQuotationCharacter = ‘”‘;
msbl.Load(); // HERE THE EXCEPTION RAISES UP
connection.Close();
}
What’s the full exception you’re getting?
Try checking the secure_file_priv configuration to see which directory it’s looking for your database in.
Even if you set MySqlBulkLoader.Local = true, it’s dependent on the “local_infile” configuration option being true.
If you could provide a small sample project that would be helpful as well! You can send it to support AT wisej.com.
Best regards,
Levie
Please login first to submit.