T
Thomas Stein
I want to get in a java prgm all those database records whose MYDATE column contains a
date greater equal a given other date (say: today). How do I specify this
in a SQL query from Java?
Assume the comparison date in java is in a java.util.Date field. Do I have to convert it
into a variable of type java.sql.Date?
The resulting code should look similar to:
java.util.Date somejavadate = new java.util.Date();
java.sql.Date somesqldate = new java.sql.Date(somejavadate);
rs = stmt.executeQuery("SELECT ... FROM ... WHERE " + somesqldate + "<= MYDATECOL");
MYDATECOL is defined with a type "datetime".
However this does not work.
How does the exact query look like?
Is the date query database product specific?
Thomas
date greater equal a given other date (say: today). How do I specify this
in a SQL query from Java?
Assume the comparison date in java is in a java.util.Date field. Do I have to convert it
into a variable of type java.sql.Date?
The resulting code should look similar to:
java.util.Date somejavadate = new java.util.Date();
java.sql.Date somesqldate = new java.sql.Date(somejavadate);
rs = stmt.executeQuery("SELECT ... FROM ... WHERE " + somesqldate + "<= MYDATECOL");
MYDATECOL is defined with a type "datetime".
However this does not work.
How does the exact query look like?
Is the date query database product specific?
Thomas