Is it possible to use the mysql
command LOAD DATA INFILE
as PreparedStatement
? Because java seems to interpret the ?
placeholder as filename itself.
Statement st = con.prepareStatement("LOAD DATA LOCAL INFILE '?'...");
for (file : files) {
st.setString(1, file.getAbsolutePath());
st.addBatch();
}
st.executeBatch();
Result:
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964) ~[mysql-connector-java-5.1.41.jar:5.1.41]