| Author |
how to insert date to the database using jdbc
|
Arun raghvan
Ranch Hand
Joined: Aug 22, 2010
Posts: 75
|
|
Could some help me out ,with this .
i'm unable to insert date to the date field of EMP table
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
Use a PreparedStatement.
Also - unless you are using Access as your database you probably don't want to use the JDBC-ODBC bridge.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Gian Franco
blacksmith
Ranch Hand
Joined: Dec 16, 2003
Posts: 975
|
|
Hi Arun,
Try instead of
|
"Eppur si muove!"
|
 |
Gian Franco
blacksmith
Ranch Hand
Joined: Dec 16, 2003
Posts: 975
|
|
...additionally the names scott and tiger reveal that it is most probably an Oracle database.
Personally I would always put the list of column names in the INSERT statement as well and not rely
on the default order of the columns.
HTH
|
 |
Nir Tal
Greenhorn
Joined: Aug 31, 2010
Posts: 12
|
|
|
try inserting the system date by using sysdate instead of the to_char. If this works, I will let you know how to insert the user specific one.
|
 |
 |
|
|
subject: how to insert date to the database using jdbc
|
|
|