• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to insert date to the database using jdbc

 
Arun raghvan
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could some help me out ,with this .

i'm unable to insert date to the date field of EMP table
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a PreparedStatement.

Also - unless you are using Access as your database you probably don't want to use the JDBC-ODBC bridge.
 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Arun,

Try instead of
 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic