DelphiFAQ Home Search:
General :: Databases :: mysql
General information about mysql - how to get around the differences between version 3.33 an 4, how to do stuff that you think you need a nested query for etc.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

JDBC error message Illegal hour value for java.sql.Time type in value

Question:

I am getting a mysql exception with JDBC:

javax.servlet.ServletException: java.sql.SQLException: java.sql.SQLException: Illegal hour value '94' for java.sql.Time type in value '94:42:06.

The statement runs OK in the mysql shell (see below).
What can I do?

Answer:

This is a known bug in mysql 5.0

A workaround is to convert this query to return a string. E.g. you can query

concat('',timediff(NOW(),from_unixtime(max(t_time))))

Then the returned value will be a string instead of a time field and JDBC will not parse it.

mysql> select timediff(NOW(),from_unixtime(max(t_time))) from [..]
 
 +--------------------------------------------+
 | timediff(NOW(),from_unixtime(max(t_time))) |
 +--------------------------------------------+
 | 94:41:48                                   | 
 +--------------------------------------------+
 1 row in set (0.09 sec)
 
 
 

Generated 20:00:34 on Jun 18, 2018