this is as follows my source code and run time error i got how i can solve this please inform me ASAP:
compilationimport java.sql.*; import java.lang.*; public class ExcelInsertDemo { public static void main(String args[])throws ClassNotFoundException,SQLException { String driverclass="sun.jdbc.odbc.JdbcOdbcDriver"; String url="jdbc:odbc:xldsn"; String user="sa"; String password=""; Class.forName(driverclass); System.out.println("driver loaded successfully"); Connection con=DriverManager.getConnection(url,user,password); /*if(con!=null) System.out.println("Connected to the database with the database now"); */ Statement st=con.createStatement(); String sql="insert into [Sheet1$] values(12,pavan,90)"; st.executeUpdate(sql); System.out.println("query executed"); con.close(); } }
C:\>javac ExcelInsertDemo.java
C:\>java ExcelInsertDemo
driver loaded successfully
Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC Excel Driver]
Too few parameters. Expected 1.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc .java:6957)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java :7114)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java :3110)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcSt atement.java:338)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Jdbc OdbcStatement.java:
288)
at ExcelInsertDemo.main(ExcelInsertDemo.java:20)