Hi All, Does anyone know how to update records in an Excel file using JDBC. This is what I did Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc dbc:Excel","",""); Statement st = con.createStatement(); String sql = "INSERT INTO sheet1$ VALUES ('Preeti', 'Chopra' )"; st.executeUpdate(sql); st.close(); con.close(); but the system throws the following exception Message SQLException = [Microsoft][ODBC Excel Driver] Syntax error in INSERT INTO statement. However, the code works perfectly when used with MSAccess. Can anybody give any idea please??? Regards Preeti
Neeraj Mishra
Greenhorn
Joined: May 02, 2001
Posts: 2
posted
0
If u want to write to excel using data from database the use IO of java The code u have shown simply dont say that what type of seperator u are going to use, But still I am a linux worker So if u dont get the result by using it first try to write to flat file then to excel using proper seperator If not i will mail u the codes om monday With regards Neeraj
Preeti Chopra
Greenhorn
Joined: May 14, 2001
Posts: 5
posted
0
Dear Neeraj, Thanx for your reply. Let us assume that i use separators also, I guess that will not automate the writing to excel file. It will be a plain text file. Also I need to find out how to write to different sheets of Excel file, how does one achieve that? Any idea? Regards Preeti