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 Need to update date from jsp to mysql database. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Need to update date from jsp to mysql database." Watch "Need to update date from jsp to mysql database." New topic
Author

Need to update date from jsp to mysql database.

Jaidev Arer
Ranch Hand

Joined: Mar 12, 2010
Posts: 38
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
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35443
    
    9
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.


Android appsImageJ pluginsJava web charts
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26496
    
  78

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jaidev Arer
Ranch Hand

Joined: Mar 12, 2010
Posts: 38
Jeanne Boyarsky,
Thanks for your time.
Will work on that line.
Thanks again
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Need to update date from jsp to mysql database.
 
Similar Threads
Changing from MSAccess to MySQL
pagination design
jsp and mysql error
connecting mysql database on net
Help with update