File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
JDBC MS Access Date comparison
Joined: Dec 09, 2000
Jul 24, 2005 12:34:00
I am accessing an MS Access database via
I can happily connect and retrieve a result set and even subset the results with
Now...each record contains a MS Access "Date/Time" field.
How can I specify in my SQL in my
method, that I only want to retrieve records that are newer than a given, date?
I am creating a string that stores my SQL query and passing this to the executeQuery() method.
I suppose I need to A) Define my comparisn date and then B) somehow pass that into my SQL query statement.
I am not sure how to do either...
All assistance is warmly welcomed.
SCJP 1.4 (93%)<br />SCJD (In progress. It can run, but it can't hide...)
author & internet detective
Joined: May 26, 2003
Jul 24, 2005 18:48:00
Since you are dealing with Dates, you will want to use a PreparedStatement. This lets the driver handle all the icky date details for you.
The query would go something like this:
"select columns from table where date_column > ?"
Then you can call:
For more details on the PreparedStatement, check the
How To Ask Questions The Smart Way
Blogging on Certs:
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
I agree. Here's the link:
subject: JDBC MS Access Date comparison
how to update multiple table in frame
Access Data source using program
parsing in servlet
time for database access
JDBC connection to MS SQL Server .. HELP
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014