Search code examples
javamysqlprepared-statementreturn-valueload-data-infile

Java Statement, Load Data return generated keys


My Question might be very simple, but i can't find any answer for it.

If i execute statement.execute("LOAD DATA ...") will it generate return keys exactly like INSERT Statement,

If i do not wish to recieve any return value from the LOAD DATA statement, should i execute:

statement.execute("LOAD DATA ...",Statement.NO_GENERATED_KEYS) or is it unnecessary since statement.execute("LOAD DATA ...") will not return any keys in this case?


Solution

    1. You have to use Statement.executeUpate() for LOAD DATA
    2. If you do not need return values, use Statement.executeUpdate("LOAD DATA..", Statement.NO_GENERATED_KEYS)