• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help with a exception

 
ben riches
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello i hope someone can help me please
i have this code
but i get a exception the exception says
[microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
what does this mean could someone please explain please
thanks ben
p.s. my code is below
import java.sql.*;
class JD {

public static void main (String[] args) {
String data = "jdbc dbc:World Energy";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(data,"","");
Statement st = conn.createStatement();
st.executeUpdate("INSERT INTO Coal (FIPS, Country, Year)" +
"VALUES (gh, 'ghia', 1991)");

conn.close();
} catch (Exception e) {
System.err.println("Got an exception! ");
System.err.println(e.getMessage());
}

}
}
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this
st.executeUpdate("INSERT INTO Coal (FIPS, Country, Year)" + "VALUES ('gh', 'ghia', 1991)");
(Look at the quotes around the gh).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic