| Author |
JDBC setDate (oracle driver).
|
lvkiran
Greenhorn
Joined: May 14, 2003
Posts: 3
|
|
I have a column with "DATE" as datatype ..As part of a batch process I need to insert the start date and time into that (YYYY-MM-DD HH24:MI:SS). If i use just the Statement and the to_date function in the "values" clause it works ..but this is an existing application using "Prepared Statement" and we're migrating from sybase to oracle. When I am trying to use the setDate function it is just inserting the date part and putting zeros (00:00:00) for time part where as in sybase just the setString was taking care of everything ... Any suggestions please ...
|
 |
Andy Bowes
Ranch Hand
Joined: Jan 14, 2003
Posts: 171
|
|
Have you tried using the setTimestamp() method on the Prepared Statement ? e.g. java.util.Date now = new java.util.Date(); ps.setTimestamp( new java.sql.Timestamp(now.getTime()) ); I think that the setDate() method only sets the date portion of the DateTime column. HTH
|
Andy Bowes<br />SCJP, SCWCD<br />I like deadlines, I love the whoosing noise they make as they go flying past - Douglas Adams
|
 |
lvkiran
Greenhorn
Joined: May 14, 2003
Posts: 3
|
|
|
Thanks Andy .. that works..
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
lv, Welcome to JavaRanch! We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy. Thanks Pardner! Hope to see you 'round the Ranch!
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
 |
|
|
subject: JDBC setDate (oracle driver).
|
|
|