Symptom
- Time missing.
- Date Time fields, shows as Date only.
- Database Fields Data Type shows as Date when connecting to MySQL, when expecting a Date Time.
- When reporting off MySQL data source in Crystal Reports using an ODBC connection, the Date Time fields shows as a Date only.
Environment
- SAP Crystal Reports 2016
- SAP Crystal Reports 2020
- MySQL 8
Reproducing the Issue
- In the Microsoft ODBC Data Source Administrator, create an ODBC DSN to MySQL database using the ODBC Driver:
MySQL ODBC Connector version 8.0.28, or 8.0.31
- In Crystal Reports, create a report based on an ODBC connection to a MySQL database.
- Insert a Date Time field on the report.
- Refresh the report, and notice it only shows the Date, and not the Time for the Date Time fields.
Cause
- Crystal Reports send a standard SQL to obtain the Table and Fields information.
- The MySQL ODBC Connector 8.0.28 to 8.031 used to connect to MySQL returns the incorrect data type for Date Time field, and this is why it shows the Data Type as Date, instead of Date Time.
Resolution
- Use the latest MySQL Connector ODBC driver 8.0.32, which returns the correct database fields data type of Date Time:
- From the MySQL website, download the MySQL Connector ODBC driver 8.0.32
- Install the MySQL Connector ODBC driver 8.0.32
- In Microsoft ODBC Data Source Administrator, create an ODBC DSN to the MariaDB database using the ODBC Driver:
MySQL ODBC 8.0 Unicode Driver
- In Crystal Reports, create a report based on an ODBC DSN connection to the MySQL
Keywords
CR, MySQL , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem
Product
SAP Crystal Reports 2016 ; SAP Crystal Reports 2020