how to Solve this error and made load data query to open my file??
I get java.sql.SQLException: Unable to open file when trying to create statement from file. Code:
public class LoadData {
public static void main(String[] args) throws Exception {
File file=new File("C://Users//suriyan.s//Documents//suriyan//employees.csv");
String filename = file.getAbsolutePath();
System.out.println(filename);
String tablename = "employee";
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/college", "root", "");
// Load the data
String qry = "LOAD DATA LOCAL INFILE '" + filename + "' INTO TABLE " + tablename + " FIELDS TERMINATED BY ','"
+ " LINES TERMINATED BY '\n';";
Statement stmt = connection.createStatement();
stmt.execute(qry);
}
}