Bug #6231 JDBC driver does not convert time columns to timestamps

Submitted: 23 Oct 2004 22:27 Modified: 31 Mar 2014 7:50
Reporter: Steve Millidge Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.0.15-ga OS:Windows (XP)
Assigned to: Alexander Soklakov CPU Architecture:Any

[23 Oct 2004 22: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 17:14] Mark Matthews
This is fixed for 3.0.16-ga and 3.1.5.
[25 Apr 2005 14:30] a a
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 18: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?
[27 May 2005 23: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".
[31 Mar 2014 7:50] Alexander Soklakov
Fixed in 3.0.16 and 3.1.5

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.