aspose file tools*
The moose likes JDBC and the fly likes Setting date to oracle using Prepared Statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Setting date to oracle using Prepared Statement" Watch "Setting date to oracle using Prepared Statement" New topic
Author

Setting date to oracle using Prepared Statement

Vasudevan Gopalan
Ranch Hand

Joined: Aug 29, 2003
Posts: 67
Hi,
I am setting date to oracle using prepared statement.I am using the following code

In database it is setting date alone but not the hour,minute and sec.I need to set the date with hour,minute & sec.

Regards
Vasu
[ February 29, 2004: Message edited by: Vasudevan Gopalan ]
Bikramjit Singh Bajwa
Ranch Hand

Joined: Nov 23, 2003
Posts: 39
Pass following method in your java.sql.Date constructure
System.currentTimeMillis()
Hope this works
Chakk de
Bikram
Bikramjit Singh Bajwa
Ranch Hand

Joined: Nov 23, 2003
Posts: 39
Sorry to tell you one thing more..
may be your database field would be Date type only instead of DateTime or timestamp..
Chakk de
Bikram
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the JDBC forum...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Christopher Zinn
Greenhorn

Joined: Nov 03, 2003
Posts: 13
java.sql.Date will only fill out the date portion;
java.sql.Timestamp will fill in both portions

- Chris
Vasudevan Gopalan
Ranch Hand

Joined: Aug 29, 2003
Posts: 67
Thanks Christopher...
 
jQuery in Action, 2nd edition
 
subject: Setting date to oracle using Prepared Statement