I'm doing a JavaAFX application using the MS Access 2007 database. I need to extract data from the database by filtering after the date.
This work good:
ResultSet rs = stat.executeQuery("SELECT * FROM Notification WHERE
postDate>=#2018-01-18# AND getDate<=#2019-02-18#");
But this not:
private final static String GET_ALL =
"SELECT * FROM Notification WHERE postDate>=? AND getDate<=?";
public ArrayList<Notification> getAllNotification(LocalDate postDate, LocalDate getDate) {
PreparedStatement prepStmt = conn.prepareStatement(GET_ALL);
prepStmt.setDate(1, java.sql.Date.valueOf(postDate));
prepStmt.setDate(2, java.sql.Date.valueOf(getDate));
ResultSet rs = prepStmt.executeQuery();
}
What I'm doing wrong or what I'm not doing. I am using of course the ucanaccess library in version 4.0.3. Any suggestion or tip?