File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes help with a exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "help with a exception" Watch "help with a exception" New topic

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 {
Connection conn = DriverManager.getConnection(data,"","");
Statement st = conn.createStatement();
st.executeUpdate("INSERT INTO Coal (FIPS, Country, Year)" +
"VALUES (gh, 'ghia', 1991)");

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

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).

Quaerendo Invenietis
I agree. Here's the link:
subject: help with a exception
jQuery in Action, 3rd edition