• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need to update date from jsp to mysql database.

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Need help to write a update query to update current (sysdate) from JSP to mysql database.
The problem is mysql will store data field in yyyy-mm-dd format.
So how to go about it.
Thganks
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The problem is mysql will store data field in yyyy-mm-dd format.


What is the problem with that? Besides, if the DB field is of type timestamp or some such, then it has no format associated with it - any formatting would need to be done by the client.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jaidev,
It is good practice to use a PreparedStatement. Then you can call setDate() and getDate() rather than worrying about database specific formatting. And use SimpleDateFormat to display in the desired format in your JSP.

It is also good practice to do your JDBC code from someplace other than a JSP.
 
Jaidev Arer
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne Boyarsky,
Thanks for your time.
Will work on that line.
Thanks again
reply
    Bookmark Topic Watch Topic
  • New Topic