I have a MySQL query like this:
truncate table A;load data local infile '~/some.csv' into table A fields terminated by ',' OPTIONALLY ENCLOSED BY '\"' (COLUMN1,COLUMN2,COLUMN3)
It runs perfectly when I run it in workbench but when it is executed by the java app:
String qry = "truncate table A;load data local infile '~/some.csv' into table A fields terminated by ',' OPTIONALLY ENCLOSED BY '\"' (COLUMN1,COLUMN2,COLUMN3)";
Connection con = DriverManager.getConnection(HOST, USER, PASSWORD);
java.sql.Statement stmt = con.createStatement();
stmt.execute(qry);
I get:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'load data local infile '~/some.csv' into table A' at line 1
Version on Server is: MySQL 5.6.27
On my local machine it is: 5.7.19, for Linux (x86_64)
PS: The query I run in workbench is the one I logged in the java app.