MySQL Forums
Forum List  »  Connector/C++

Re: Load Data Local Infile with Connector/C++
Posted by: Rafal Somla
Date: August 21, 2018 04:34AM

The information Luis has provided concerns the MySQL Client Library and Con/C++ 8.0 legacy part that internally uses MySQL Client Library. So, by default a new legacy connection will not support LOCAL INFILE statements but I believe this default can be changed with connection options.

However, I think the original context is executing LOCAL INFILE statement using X DevAPI (Session.sql(...).execute()). I am afraid LOCAL INFILE is not supported in this context. The reason is that X DevAPI uses the new MySQL X Protocol to communicate with the server and X Protocol does not have support for LOCAL INFILE operations. To make it work we would have to first extend the X Protocol and it is not even clear if MySQL will want to extend it in that direction.

So, for now you must accept it as a limitation that LOCAL INFILE SQL statements won't work over X Protocol. You can use Table.insert() operation to perform a bulk insert of rows into a table:


See <>;.

This bulk insert should be quite efficient over X Protocol, because it sends all the data in a single operation (but you must be careful to not exceed packed size limits).

Also, loading data from files on the server should work, provided that all the privileges are set correctly.

Options: ReplyQuote

Written By
September 19, 2018 09:09AM
Re: Load Data Local Infile with Connector/C++
August 21, 2018 04:34AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.