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 how to insert date to the database using jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to insert date to the database using jdbc " Watch "how to insert date to the database using jdbc " New topic
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: 977
Hi Arun,

Try instead of


"Eppur si muove!"
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
...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.
 
wood burning stoves
 
subject: how to insert date to the database using jdbc