I am new to ucanaccess. I am developing a java swing application, I am using MS Access 2016 to store my DB.I am trying to insert values into my table. I am using sql's insert into query. Everything seems right, but then I am getting error saying parameter marker not allowed (I think its referring to "?" which I used to pass variables to my query).

Here is the is the DB code:

public static void updateDB(String NOBOOKS, java.util.Date DOI, java.util.Date DOR){


            Connection on = DriverManager.getConnection("jdbc:ucanaccess://Database/UserDetails.accdb");

            Statement stmt = on.createStatement();

            String sql = "SELECT * FROM Member";


            ResultSet result = stmt.executeQuery(sql);




                    String N = NOBOOKS;

                    Date I = new Date(DOI.getTime());

                    Date R = new Date(DOR.getTime());

                    String sqlUpdate = "INSERT INTO Member (Issues,DOI,DOR) VALUES (?,?,?)";

                    PreparedStatement values = on.prepareStatement(sqlUpdate);

                    System.out.println("The DOI is "+ DOI);

                    System.out.println("The I is "+ I);

                    System.out.println("The DOR is "+ DOR);

                    System.out.println("The R is "+R);


                    values.setString(1, N);

                    values.setDate(2, I);

                    values.setDate(3, R);




        }catch(Exception se){




and this is the output i am getting.


Tue Sep 20 00:00:00 IST 2016

The DOI is Mon Sep 05 00:00:00 IST 2016

The I is 2016-09-05

The DOR is Tue Sep 20 00:00:00 IST 2016

The R is 2016-09-20

net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.6 parameter marker not allowedBUILD SUCCESSFUL (total time: 25 seconds)

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

by (171 points)
+1 vote

Hi Sagar,

You need to use "executeUpdate()" without parameters. 

And line : "stmt.executeUpdate(sqlUpdate);" is senseless. 

You must use "values.executeUpdate()" instead of the line : "stmt.executeUpdate(sqlUpdate);".

Hope it helps.

by (143 points)
Very accurate!
Thanks a lot @Mayur.