Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-533

Wrong value when inserting time data type with JDBC java.sql.Time

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 1.6.0, 2.1.2
    • 2.2.0, 1.7.0
    • Other
    • Mac, Linux, MariaDB 10.2.6, 10.2.7 (Linux Galera)

    Description

      This bug is related to a bug which I've discovered that doesn't happen on MariaDB JDBC Driver Version 1.5.9, but it happened on any version from 1.6.x onwards all the way to ver 2.1.2. The main issue is that whenever a value of 5:00:00 is inserted into the column, and later queried, it will become 19:00:00.

      To reproduce this issue:
      1) Create a db and table like the below:
      drop database if exists time_test;
      create database if not exists time_test default character set = 'utf8' collate utf8_bin;
      use time_test;
      set storage_engine=InnoDB;

      create table t_time_test (
      uuid char(36) not null,
      time_field time not null,
      primary key(uuid)
      );

      2) I have attached some codes in Java (namely TimeTest.java). This small program inserts a row with the 'time_field' column value of 5AM (doesn't matter about date or time zone), and later query the row inserted. It turns out that on MariaDB JDBC Driver 1.5.9, the time_field column is 05:00:00, but if I were to run this with MariaDB JDBC Driver 1.6.x or 2.1.x, the time_field column is 19:00:00.

      MariaDB's TimeZone through "SHOW GLOBAL VARIABLES LIKE 'time_zone'" is 'SYSTEM'.

      Help is much appreciated.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            maxlam Max Lam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.