Hi guys,
I have got a question regarding LOAD DATA INFILE. Can some one save my day.
1. I want to import a txt file into mysql database.
when I use the following query in the mysql> prompt its fine.
which is
when I do it java I am getting error
Error
-----------
java.sql.sqlExc eption: General error message from server:
"File 'D:/Sen.txt' not found <ErrCode: 2>"
But The file already exists
Code:
My text file(Sen.txt) is like this...
abc,1
bcd,2
adf,3
I dont know why its say like that
Can anyone help me out in this...
thanks...
senthil.
I have got a question regarding LOAD DATA INFILE. Can some one save my day.
1. I want to import a txt file into mysql database.
when I use the following query in the mysql> prompt its fine.
which is
when I do it java I am getting error
Error
-----------
java.sql.sqlExc eption: General error message from server:
"File 'D:/Sen.txt' not found <ErrCode: 2>"
But The file already exists
Code:
Code:
try { con = DriverManager.getConnection(url, "root", ""); stmt = con.createStatement(); stmt.executeUpdate(createString); String filename = "D:/Sen.txt"; String tablename = "IMPORT"; stmt.executeUpdate("LOAD DATA INFILE \"" + filename + "\" INTO TABLE " + tablename + " FIELDS TERMINATED BY ','"); stmt.close(); con.close(); }
abc,1
bcd,2
adf,3
I dont know why its say like that
Can anyone help me out in this...
thanks...
senthil.
Comment