Bug #6231 JDBC driver does not convert time columns to timestamps
Submitted: 24 Oct 2004 0:27 Modified: 27 May 2005 20:13
Reporter: Steve Millidge
Status: No Feedback
Category:Connector/J Severity:S2 (Serious)
Version:3.0.15-ga OS:Microsoft Windows (XP)
Assigned to: Mark Matthews Target Version:

[24 Oct 2004 0:27] Steve Millidge
Description:
Connector J does not covert time fields into JDBC timestamps.

The stack trace from the driver is;

SEVERE: Cannot convert value '09:00:36' from column 6(09:00:36 ) to TIMESTAMP.
23-Oct-2004 22:52:08 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 0, SQLState: S1009
23-Oct-2004 22:52:08 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Cannot convert value '09:00:36' from column 6(09:00:36 ) to TIMESTAMP.
23-Oct-2004 22:52:08 net.sf.hibernate.JDBCException <init>
SEVERE: Could not execute query
java.sql.SQLException: Cannot convert value '09:00:36' from column 6(09:00:36 ) to
TIMESTAMP.
	at com.mysql.jdbc.ResultSet.getTimestampInternal(ResultSet.java:3982)
	at com.mysql.jdbc.ResultSet.getTimestamp(ResultSet.java:1896)
	at com.mysql.jdbc.ResultSet.getTimestamp(ResultSet.java:1910)
	at
org.apache.commons.dbcp.DelegatingResultSet.getTimestamp(DelegatingResultSet.java:261)
	at net.sf.hibernate.type.TimestampType.get(TimestampType.java:24)

How to repeat:
Create a table with a time field and try to get the value of the field using JDBC.

Suggested fix:
In com.mysql.jdbc.ResultSet.java lines 3914 - 3925 the code assumes anything with 8
characters is a two digit date rather than a time field in the format

HH:mm:ss
[5 Nov 2004 18:14] Mark Matthews
This is fixed for 3.0.16-ga and 3.1.5.
[25 Apr 2005 16:30] [ name withheld ]
i have the same problem with v3.1.8. When trying v3.0.16ga it works. I suggest checking if
it was really solved for 3.1
[27 Apr 2005 20:13] Mark Matthews
Are you sure you're really using 3.1.8 and you don't have some older version laying around
in your CLASSPATH?

I just looked and the fix (and testcase) is definitely in 3.1.8, so this _should_ be
fixed, and running the testcase here locally shows that it is.

Can you post the _full_ stacktrace from your machine?
[28 May 2005 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".