Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-345

Date values between 1970 and 2038 not saved

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.1.14
    • 3.1.15
    • General
    • None
    • windows 10

    Description

      I’m using vb6 with ADODB.recordset. When I add a new row with date field, if the value is between 1970 and 2038 , it accepts it, but if not, Mariadb crashes and raises a the field can be null (is defined in the table definition)

      It seems MariaDb connector is the focus of the crash, putting only dates between 1970 and 2038 years. Its solution is to redefine table sturcture

      I attach the code

      Thanks

      Attachments

        Issue Links

          Activity

            JoanSama Joan Samà Camí created issue -
            JoanSama Joan Samà Camí added a comment - - edited

            I've tried it in MsAccess linking to a DSN using ODBC and it also gives an error

            insert into TestDB.TestTable (FieldDate) values (cdate("12-12-1910"))

            Using 'Mysql Odbc' driver or HeidiSql works fine.

            JoanSama Joan Samà Camí added a comment - - edited I've tried it in MsAccess linking to a DSN using ODBC and it also gives an error insert into TestDB.TestTable (FieldDate) values (cdate("12-12-1910")) Using 'Mysql Odbc' driver or HeidiSql works fine.

            It seems MariaDb processes datatime fields as timestamp fields, which only are allowed values between 1970 and 2038

            JoanSama Joan Samà Camí added a comment - It seems MariaDb processes datatime fields as timestamp fields, which only are allowed values between 1970 and 2038
            Lawrin Lawrin Novitsky made changes -
            Field Original Value New Value
            Attachment mariadb.txt [ 60379 ]

            Thank you for your report. I assume your script still produces error, and does not crash the application.

            What server version do you use?
            In your create statement in the script, field's type is the datetime, not the timestamp. Is the type of field in your table really datetime or timestamp? Since you say that with mysql's driver and HeidiSql these dates work, I'd imagine it's the datetime.

            What is TestDB.TestTable in your comment about test in MsAccess?

            Lawrin Lawrin Novitsky added a comment - Thank you for your report. I assume your script still produces error, and does not crash the application. What server version do you use? In your create statement in the script, field's type is the datetime, not the timestamp. Is the type of field in your table really datetime or timestamp? Since you say that with mysql's driver and HeidiSql these dates work, I'd imagine it's the datetime. What is TestDB.TestTable in your comment about test in MsAccess?
            JoanSama Joan Samà Camí added a comment - - edited

            the server version is 10.6.5

            I use always datetime fields, but I've read data problem occurs in timestamp fields.
            In mysql drivers works fine, but in MariaDb drivers fails.
            I never use MsAccess, the previous comment is only to test purpose.
            All the lines of my script works fine, but the line that assigns fecha to 0 crashes

            I've read too MariaDb CONNECTOR fails on write dates not between 1970 and 2038
            It seems the connector handles datetime fields as timestamp fields.

            The server version or the client used does not matter, fails on all the versions.
            Only the odbc driver is affected.

            The table is the following:

            CREATE TABLE `testtable` (`FieldDate` DATETIME NOT NULL DEFAULT '1899-12-30 00:00:00')
            COLLATE='utf8_general_ci' ENGINE=InnoDB ;

            You can see the error inserting data on the following PrintScreen (https://www.levelprograms.com/descargas/Error%20Insert%20date%20MariaDB%20Odbc.png)

            Thanks

            JoanSama Joan Samà Camí added a comment - - edited the server version is 10.6.5 I use always datetime fields, but I've read data problem occurs in timestamp fields. In mysql drivers works fine, but in MariaDb drivers fails. I never use MsAccess, the previous comment is only to test purpose. All the lines of my script works fine, but the line that assigns fecha to 0 crashes I've read too MariaDb CONNECTOR fails on write dates not between 1970 and 2038 It seems the connector handles datetime fields as timestamp fields. The server version or the client used does not matter, fails on all the versions. Only the odbc driver is affected. The table is the following: CREATE TABLE `testtable` (`FieldDate` DATETIME NOT NULL DEFAULT '1899-12-30 00:00:00') COLLATE='utf8_general_ci' ENGINE=InnoDB ; You can see the error inserting data on the following PrintScreen ( https://www.levelprograms.com/descargas/Error%20Insert%20date%20MariaDB%20Odbc.png ) Thanks
            Lawrin Lawrin Novitsky made changes -
            JoanSama Joan Samà Camí made changes -
            Attachment Error Insert date MariaDB Odbc.png [ 60465 ]
            Lawrin Lawrin Novitsky made changes -
            Fix Version/s 3.1.15 [ 26802 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]

            Thanks for your interest and your fast reply.
            Do you know when 3.1.15 version will be avaiable to download?

            JoanSama Joan Samà Camí added a comment - Thanks for your interest and your fast reply. Do you know when 3.1.15 version will be avaiable to download?

            If nothing goes wrong - it will be released this week

            Lawrin Lawrin Novitsky added a comment - If nothing goes wrong - it will be released this week
            Lawrin Lawrin Novitsky made changes -
            Labels crash innodb
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 127254 ] MariaDB v4 [ 135581 ]
            Lawrin Lawrin Novitsky made changes -

            People

              Lawrin Lawrin Novitsky
              JoanSama Joan Samà Camí
              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.