Bug #93224 Different Date type returned with the same driver in win and linux
Submitted: 16 Nov 2018 10:31 Modified: 3 Jan 2019 23:12
Reporter: antonio panazzolo Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:mysql-connector-java-5.1.38-bin OS:Any (win and linux)
Assigned to: Filipe Silva CPU Architecture:x86
Tags: driver date java sql

[16 Nov 2018 10:31] antonio panazzolo
Description:
When a query is performed and a return field is defined in the DB table as DATETIME in windows env the field is of type java.util.Date and in Linux is of type java.sql.Date.
Source code is the same, JDBC driver is the same and mysql server 5.5 on win and linux.

Hibernate-core 3.3.2GA
hibernate-annotations 3.4.0.GA
hibernate-core 3.3.0.SP1
ejb3-persistence 1.0.2.GA

How to repeat:
create a table with a field of tipe DATETIME and perform a query using hibernate like this
SQLQuery query = session.createSQLQuery("SELECT * FROM table");
List result = query.list();

inside result you will find a list of array of object. The field date is of type java.util.Date on win and java.sql.Date on Linux
[3 Dec 2018 23:12] Filipe Silva
Hi Antonio,

Thank you for your interest in MySQL and Connector/J.

There are surely more things consider than just comparing the results from these two systems.

Depending on how you configured your JDBC connections you may be turning automatic time zone adjustments on, and, as a result, you may get different temporal data if the time zones on these two clients differ as well.

So, in order for us to be able to help you, we need to know more about your setup. To start with, I'd recommend you to check the MySQL server time zone, both systems (Linux and Windows) system time zones and connections strings you are using. If you don't see any obvious culprit, please share this info with us so we can take a look. We'd also need a small test case we can run (please avoid using any other third party components if possible) in order to reproduce the same behavior.

Thanks,
[4 Jan 2019 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".