I made the following statement to upload a csv to the database:
public void importarBaseBruta(File arquivo) {
try {
this.limparBaseBruta();
this.con.conectar();
this.stm = this.con.getStm();
System.out.println("- IMPORTANDO BASE BRUTA");
String path = arquivo.getPath().replace("\", "/");
String query = "LOAD DATA LOCAL INFILE '" + path + "' INTO TABLE base_bruta \n"
+ "CHARACTER SET 'latin1' \n" + "FIELDS TERMINATED BY ';' ENCLOSED BY '\"' \n" + " IGNORE 2 LINES;";
this.stm.executeUpdate(query);
this.con.fechar();
System.out.println("- TERMINOU DE IMPORTAR A BASE BRUTA DIARIA");
} catch (Exception e) {
System.out.println("ERRO NO MOMENTO DE IMPORTAR: " + e.getMessage());
e.printStackTrace();
}
}
But when the csv goes up to the bank the column moves because of quotes that are not removed:
Displacedcolumn:
I'd like to know how to remove it.