Ok im nearly there,
I create the temp file:
Code:
File repositoryPath = null;
try {
repositoryPath = File.createTempFile("tempFile",".txt");
path = repositoryPath.getAbsolutePath();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(path);
----------------------
then run the sql with the path name
Code:
System.out.println(path);
String insertData = "load data LOCAL infile '"+path+"'"+
" into table " + upFile.getNoteContent() +
" fields TERMINATED by '\\t' " +
"lines TERMINATED by '\\n' IGNORE 1 LINES";
However when do syso(repositoryPath.getAbsolutePath()); it prints
Code:
C:\Program Files\Apache Software Foundation\Tomcat 5.5\temp\tempFile45123.txt
But when the sql is run i get the error:
Code:
SQLException: Unable to open file 'C:Program FilesApache Software FoundationTomcat 5.5 emp empFile45123.txt'for 'LOAD DATA LOCAL INFILE' command.Due to underlying IOException:
How to replace the \ with \\ as path.replace("\", "\\"); shows an error
Bookmarks