Results 1 to 1 of 1
- 06-02-2011, 04:31 PM #1
Member
- Join Date
- Dec 2010
- Posts
- 15
- Rep Power
- 0
Load with values to mysql database
Hello to all.
I want to load a file with values to a Table in MySql, and the code is something like this:
The error shows that there's no file in:PHP Code:if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); log.append("Loading File: " + file.getName()+ "." + newline); Statement stmt = null; try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/Database","user","password"); stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); stmt.executeUpdate("LOAD DATA INFILE \"" + file.toURI().getPath() + "\" INTO TABLE gastos (valordesp,datadespesa,tipo,idconta,titular)"); } catch(Exception e) { e.printStackTrace(); stmt = null; } }
java.sql.SQLException: File 'C:\C:\Users\Consultor\Documents\Despesas.txt
That's because it appears 2 times C: so how can i overcome this, can anibody help?
Thanks,
Rui Oliveira
Similar Threads
-
how to load values from database on pageload using servlets
By kirankumar1231 in forum Java ServletReplies: 3Last Post: 01-26-2011, 08:48 AM -
Values saved twice in mysql
By anithajerome in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 01-19-2011, 09:15 AM -
load graphics in html page using jsp and database
By charu in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 03-04-2009, 07:12 PM -
How to convert access database to mysql database?
By vrk in forum Advanced JavaReplies: 2Last Post: 02-11-2009, 04:43 AM -
How can we load database?
By java19857 in forum New To JavaReplies: 5Last Post: 09-19-2008, 06:34 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks