• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting date to oracle using Prepared Statement

 
Vasudevan Gopalan
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pass following method in your java.sql.Date constructure
System.currentTimeMillis()
Hope this works
Chakk de
Bikram
 
Bikramjit Singh Bajwa
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the JDBC forum...
 
Christopher Zinn
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.sql.Date will only fill out the date portion;
java.sql.Timestamp will fill in both portions

- Chris
 
Vasudevan Gopalan
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Christopher...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic