Good evening, I'm reading a txt and I want to insert the data it has to a mysql table but I skip this exception:
NumberFormatException: For input string: "1".
File archivo = new File ("D:\"+nombretxt+".txt");
Scanner s = new Scanner (archivo);
PreparedStatement pst=conexion.prepareStatement("INSERT INTO 'countries' (id, country_code, country_name) VALUES (?,?,?)");
while (s.hasNextLine()){
String linea =s.nextLine();
Scanner s2 = new Scanner (linea);
s2.useDelimiter("[;\n]");
pst.setInt(1,Integer.parseInt(s2.next())); //Aca me larga el error
pst.setString(2,s2.next());
pst.setString(3, s2.next());
pst.executeUpdate();
}
s.close();