File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Date functions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Date functions" Watch "Date functions" New topic
Author

Date functions

sachin komurlekar
Greenhorn

Joined: May 09, 2001
Posts: 14
SELECT * FROM EMP WHERE DOJ > '12-JAN-82'
The above query returns all the rows present in the table.
Where as it should show only three records according to the rows inserted.
what could be the problem?
Please Give me the code if possible and how do I use the date functions in jdbc while comparing recordin the database(Msaccess)?

Daniel Dunleavy
Ranch Hand

Joined: Mar 13, 2001
Posts: 276
I assume your DOJ is defined as a date or timestamp field in the database. You have to do some kind of conversion on the string before comparing.... to_date in oracle cvdate in access
You can just pass the strings and have the prepared sql statement do the conversion and comparision
.... where doj > cvdate(instring)
sachin komurlekar
Greenhorn

Joined: May 09, 2001
Posts: 14
dear,
Daniel Dunleavy
i have used cvdate in my program,but it is giving error that the method cvdate is not found in the program.
i have used create statement.
i have imported both java.util.date & java.sql.date in my class.
please help me as soon as possible.
please give me the code.
sachin
------------------
Daniel Dunleavy
Ranch Hand

Joined: Mar 13, 2001
Posts: 276
The cvdate is for access and is used in the select statement
select * from tb1 where testdate > cvdate('12-JAN-82')
Dan
Xavier VS
Greenhorn

Joined: May 11, 2001
Posts: 7
hi,
use #date# while writing ur SQl for MS-Acess.
xavier
 
Consider Paul's rocket mass heater.
 
subject: Date functions
 
Similar Threads
invoke functions in a jpl query
date problem
Need pure java sound api
java code inside sql functions?
getting top 10 rows