Forums Register Login
Deleting from a MS Access Database
Please, I have a problem with deleting a row from in a table in a database.
This is my code:

public class CooperativeDB{

String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String host = "jdbcdbc:CTCS Database";
Connection conn = null;
public static void main(String [] args){
Class.forName (driver);
conn = DriverManager.getConnection(host, "", "");
stat = conn.createStatement();

String stringUpdate = "DELETE FROM Loan WHERE Member_ID_No = ?"
PreparedStatement ps = conn.prepareStatement(stringUpdate);
}catch(Exception e){
When I ran it, this messages were displayed:
[Ljava.lang.StackTraceElement;@1389e4 java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.

Please, help me check the code
Don't know. I don't think the Exception is occurring where you think it is. Please check the stack trace for line numbers and where the Exception is occurring. Use exc.printStackTrace(), not getStackTrace().

Please use the code button; your code is difficult to read. And please post real code; I can see a compiler error in what you have posted at a � minute look.
That message typically occurs in Access when you use a table name which isn't in the database you are connected to, and when you use a column name which isn't in the table you are using.

So that would mean you misspelled the table name or the column name. Or you connected to the wrong database.

By the way the standard way of printing the stack trace is this:

This thread has been viewed 696 times.

All times above are in ranch (not your local) time.
The current ranch time is
Oct 15, 2018 07:56:25.