This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Problem while converting datatime to timestamp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem while converting datatime to timestamp" Watch "Problem while converting datatime to timestamp" New topic
Author

Problem while converting datatime to timestamp

Shantanu Deshmukh
Greenhorn

Joined: Jul 28, 2011
Posts: 23

Hello,
I am writing a simple jdbc program, which will print data column in my table. I use this statement users.getString('update_time')
The field in my database contains, for e.g, this value 2010-01-12 20:54:35.0.
The program prints this value, but also throws exception as Cannot convert value '0000-00-00 00:00:00' from column 7 to TIMESTAMP.

Please help !!


There are no failures, only experiences
Shantanu Deshmukh
Greenhorn

Joined: Jul 28, 2011
Posts: 23

Hey folks, got a solution for that.
zeroDateTimeBehavior=convertToNull add this as a parameter in JDBC connection url to slove this problem

Hope this helps to whoever reaching to this problem
 
Don't get me started about those stupid light bulbs.
 
subject: Problem while converting datatime to timestamp
 
Similar Threads
MySQL JDBC Driver and Null Dates
add 10 days to currentDate in java.util.Date or cast to Calendar?
unable to retrieve timestamp in my servlet
unable to retrieve timestamp in my servlet
oracle date format