aspose file tools
The moose likes JDBC and the fly likes help with a exception Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "help with a exception" Watch "help with a exception" New topic
Author

help with a exception

ben riches
Ranch Hand

Joined: Nov 08, 2002
Posts: 126
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

Joined: Mar 11, 2002
Posts: 1140
Try this
st.executeUpdate("INSERT INTO Coal (FIPS, Country, Year)" + "VALUES ('gh', 'ghia', 1991)");
(Look at the quotes around the gh).


Mani
Quaerendo Invenietis
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: help with a exception
 
Similar Threads
SQL exception
Display Select Query Result in JTable
SQL Exception
JDBC Error--> [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1
Syntax error in INSERT INTO statement