File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes problem while loading data from excel to mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "problem while loading data from excel to mysql " Watch "problem while loading data from excel to mysql " New topic

problem while loading data from excel to mysql

abid shaikh

Joined: Jan 28, 2008
Posts: 1
my code
try{ Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/stock","root","root");
Statement st=con.createStatement();
String filename1="C:\\cm01MAR2002bhav.csv";

}catch(Exception e){System.out.println(e);}

java.sql.SQLException: File 'C:\ProgramData\MySQL\MySQL Server 5.5\Data\stock\cm01MAR2002bhav.csv' not found (Errcode: 2)
Philip Grove
Ranch Hand

Joined: Aug 18, 2009
Posts: 68

Your SQL statement is a "LOAD DATA INFILE" statement in which data is read from a text file by the server. If you want it to be read by the client it should be "LOAD DATA LOCAL INFILE". Using a server side statement like that requires a few things: the file must exists on the server and you need FILE privileges on the server. The client side statement is slower because it needs to send the data to the server but it does not require FILE privileges and the file only has to be on the client.
I agree. Here's the link:
subject: problem while loading data from excel to mysql
Similar Threads
Data type mapping issue
developing jsp page using cewolf
Refresh chart in jsp according to MySQL database
MySQL Connector/J
how to get mysql backup using java swing