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

ResultSet.getTime() shouldn't convert TIME fields to the server time-zone

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.1.6, 1.1.7, 1.1.8
    • 1.3.0
    • Other
    • None
    • Ubuntu 14.10, MariaDB 5.5.41-1ubuntu0.14.10.1

    Description

      According to the time-zone documentation on https://mariadb.com/kb/en/mariadb/time-zones/ TIME fields should NOT be affected by the server time-zone.

      After https://mariadb.atlassian.net/browse/CONJ-65 was solved (from 1.1.6 and onwards, that is) ResultSet.getTime() began converting TIME columns to the server time-zone. This differs from what MySQL Connector/J version 5.1 does at least.

      Attachments

        Issue Links

          Activity

            ResultSet.getDate() could also be affected by this.

            slovdahl Sebastian Lövdahl added a comment - ResultSet.getDate() could also be affected by this.

            By default, the server time zone is used, and that is normal. The MariaDB connector work accordingly.
            (mysql server with the mysql connector work a similar way.)

            But your are right, using mysql Connector/J 5.1 work by default only in UTC with MariaDB ,

            So depending on your needs :

            • Make the MySQL Connector/J problem to consider the time zone :
              if you really want to use the mysql connector, you have to populate the mysql time zone tables, and set the default time zone in configuration.
              see https://mariadb.com/kb/en/mariadb/mysql_tzinfo_to_sql/ to populate mysql time zone tables if you are on unix.
              and for setting the default time zone, add the default_time_zone parameter in my.conf :
              [mysqld]
              default_time_zone=America/Lima

            (and restart MariaDB)

            • you don't want to use server time zone :
              If you want to use one particular date in UTC, you can use the UTC_TIMESTAMP() function, that don't use the server time zone.
              if you want all time datas in UTC change the default 'SYSTEM' time-zone to UTC :
              SET GLOBAL time_zone = '+0:00'; (change time-zone to UTC), and restart MariaDB.
            diego diego dupin (Inactive) added a comment - By default, the server time zone is used, and that is normal. The MariaDB connector work accordingly. (mysql server with the mysql connector work a similar way.) But your are right, using mysql Connector/J 5.1 work by default only in UTC with MariaDB , So depending on your needs : Make the MySQL Connector/J problem to consider the time zone : if you really want to use the mysql connector, you have to populate the mysql time zone tables, and set the default time zone in configuration. see https://mariadb.com/kb/en/mariadb/mysql_tzinfo_to_sql/ to populate mysql time zone tables if you are on unix. and for setting the default time zone, add the default_time_zone parameter in my.conf : [mysqld] default_time_zone=America/Lima (and restart MariaDB) you don't want to use server time zone : If you want to use one particular date in UTC, you can use the UTC_TIMESTAMP() function, that don't use the server time zone. if you want all time datas in UTC change the default 'SYSTEM' time-zone to UTC : SET GLOBAL time_zone = '+0:00'; (change time-zone to UTC), and restart MariaDB.

            Sorry, I wasn't clear enough in the original description. What I meant by "This differs from what MySQL Connector/J version 5.1 does at least." was that the described behaviour differs from the mysql connector with mysql server (not mysql connector+mariadb server). I'm not interested in using mysql connector with mariadb server at all. The issue is that the same code behaves differently when mariadb connector+server and mysql connector+server is used.

            >> By default, the server time zone is used, and that is normal. The MariaDB connector work accordingly.
            >> (mysql server with the mysql connector work a similar way.)

            How is that normal? The documentation I linked to clearly states that "Some functions are not affected. These include: UTC_TIMESTAMP() as well as DATETIME, DATE and TIME columns.". When mysql connector+server is used no conversion is done.

            slovdahl Sebastian Lövdahl added a comment - Sorry, I wasn't clear enough in the original description. What I meant by "This differs from what MySQL Connector/J version 5.1 does at least." was that the described behaviour differs from the mysql connector with mysql server (not mysql connector+mariadb server). I'm not interested in using mysql connector with mariadb server at all. The issue is that the same code behaves differently when mariadb connector+server and mysql connector+server is used. >> By default, the server time zone is used, and that is normal. The MariaDB connector work accordingly. >> (mysql server with the mysql connector work a similar way.) How is that normal? The documentation I linked to clearly states that "Some functions are not affected. These include: UTC_TIMESTAMP() as well as DATETIME, DATE and TIME columns.". When mysql connector+server is used no conversion is done.
            diego dupin Diego Dupin added a comment -

            Forget to close this issue since it was relative to CONJ-86.
            That has been fixed in 1.3.0

            diego dupin Diego Dupin added a comment - Forget to close this issue since it was relative to CONJ-86 . That has been fixed in 1.3.0

            People

              diego dupin Diego Dupin
              slovdahl Sebastian Lövdahl
              Votes:
              1 Vote for this issue
              Watchers:
              4 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.