[CONJ-247] Failing to correctly identify CST(TimeZone) Created: 2016-01-14  Updated: 2016-08-23  Resolved: 2016-08-23

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.3.3, 1.3.4
Fix Version/s: 1.5.1-RC

Type: Bug Priority: Critical
Reporter: Tong Wang Assignee: Diego Dupin
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

java version "1.7.0_75"
10.0.21-MariaDB


Attachments: PNG File 111.png     PNG File image-2016-01-14-13-11-23-593.png    

 Description   

Environment:
The System TimeZone is UTC +8:00 - CST(China Standard Time)
mariadb:
SHOW VARIABLES LIKE '%time_zone%';
system_time_zone CST
time_zone SYSTEM

It happens when i create a preparedStatement and set a timestamp value

 
private Timestamp occurTime;
 
 public Timestamp getOccurTime() {
        return occurTime;
    }
 
    public void setOccurTime(Timestamp occurTime) {
        this.occurTime = occurTime;
    }
 
 public void convertToStatement(PreparedStatement preparedStatement) throws SQLException {
  preparedStatement.setTimestamp(1, occurTime);
}

The correct value is '2016-1-12 10:00:45 257452' AND The value in _stmt(preparedStatement ) is '2016-1-11 20:00:45 257452'

The gap is 14 hours ,So is it convert incorrectly to Central Standard Time (UTC -6:00)?



 Comments   
Comment by Diego Dupin [ 2016-01-22 ]

You will correct me if i've not understand well your problem :
My understanding is that your server is configured with "CST" timezone (i was thinking it was not possible since like 10 years).
3 letters timezone are deprecated since a long time, because some of them are confusing, particulary "CST": "CST" could be U.S. "Central Standard Time" (=UTC-6) and "China Standard Time" (UTC+8).
Java as maintain those 3 letters timezone for compatibility with java 1.1, but those are considered deprecated.

So there is many solution depending of the fact you can have access to server or not :
The best is to change server timezone, but if not possible, you can add the option "serverTimezone" to connection string to defined the timezone.

Comment by Diego Dupin [ 2016-08-23 ]

close since no answer since more than 6 month

Generated at Thu Feb 08 03:14:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.