3 Replies Latest reply on Nov 26, 2018 9:17 AM by shawkins

    Unable to set value for YEAR datatype in MySQL.

    rujutas

      Hi,
      I am trying to insert data into a column of type "YEAR" in a table in MySQL database using Teiid.

      When I try to string in the year field it gives me the following error :-

      Caused by: org.teiid.core.TeiidProcessingException: TEIID30082 Remote org.teiid.api.exception.query.QueryResolverException: TEIID30082 Expected value of type 'date' but ''2019'' is of type 'string' and no implicit conversion is available.

       

      So I tried to insert an object of java.sql.date with the date 2018-05-05. This time I got the following error :-

      Caused by: java.sql.SQLException: Remote java.sql.SQLException: Data truncated for column 'year' at row 1

       

       

        • 1. Re: Unable to set value for YEAR datatype in MySQL.
          shawkins

          > When I try to string in the year field it gives me the following error

           

          The JDBC driver is reporting a jdbc type of Date - which Teiid then expects to be a full date.  Our literal handling is very strict to ensure as much source compatibility as possible.

           

          > So I tried to insert an object of java.sql.date with the date 2018-05-05. This time I got the following error

           

          Teiid is passing the value down to MySQL, but MySQL probably does not like that it contains non-default day/month values.  Can you try using 2018-01-01?

           

          If that still doesn't work that means that we need to look at a different mapping/handling of the mysql year type.

          • 2. Re: Unable to set value for YEAR datatype in MySQL.
            rujutas

            Hi,
            I tried using 2018-01-01. But the issue still exists.

            • 3. Re: Unable to set value for YEAR datatype in MySQL.
              shawkins

              It appears that mariadb will truncate automatically with just a warning, but you are seeing a hard error with mysql.

               

              Can you log an issue for this?