0

Is there a way to use the LOAD DATA LOCAL INFILE command to load data from memory in c#? The closest I can come up with is executing a command like:

INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);

I'm trying to avoid needing to write a file to the disk (fun with permission issues) on the client's system.

2
  • 1
    It's a database. How are you going to prevent it from writing to the disk if it wants to? Why would you want to prevent such writing? Are you looking for an in-memory database? Commented Nov 7, 2013 at 16:48
  • 2
    @RobertHarvey The question is not how to prevent the database from writing to disk. The question is how to use LOAD DATA LOCAL INFILE on the client, without the client writing the data to a file first. (This is possible in the Java JDBC driver, I don't know about the .NET driver though.) Commented Nov 7, 2013 at 17:02

1 Answer 1

3

No you cant. It must read fom a file on disk. Txt or csv are most common.

http://dev.mysql.com/doc/refman/5.1/en/load-data.html

Sign up to request clarification or add additional context in comments.

5 Comments

How would the server know where the data comes from if you use the --local option? It's all just a stream of bits over TCP/IP either way (since the file isn't on the server). If nothing else, a custom client could follow the protocol but read from memory instead of disk while sending.
"The --local option causes mysqlimport to read data files from the client host". The Syntax LOAD DATA INFILE still requiers a txt file to read from. Hence, my answer to the question if its possible to use LOAD DATA INFILE with a memory table as source.
There's also a corresponding LOCAL option on the first line when running from in the DB. Does pretty much the same thing regardless of which client you use.
@ebyrob, Im sorry im not sure what you mean. I assume you mean the LOAD DATA 'LOCAL' INFILE? But are you saying its not needed to use a file for the load data local infile syntax?
The official client doesn't support it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.