mySQL connection with JDBC driver and timezone error

11 views (last 30 days)
Hey,
I need to connect to a mySQL database of my university which is unfortunately configured with a unrecognized timezone "CEST" what is pointed out by the JDBC driver assistant. NOw I need to set driver parameters for a timezone in MATLAB somewhat like that:
>> conn = database('test', 'user', 'pw', 'driver', 'com.mysql.cj.jdbc.Driver', 'url', '?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC')
As a response I get "No timezone mapping entry ...". What am I doing wrong? I can connect through dBeaver with a timezone setting though.
Thanks!
PS. Can somebody show me a complete script to connect to a JDBC database? How do I select the driver? etc.

Answers (1)

Arpan Badeka
Arpan Badeka on 22 Aug 2019
Hi,
Use something similar to the following command to fix the issue:
>> conn = database('',<username>,<password>,'com.mysql.cj.jdbc.Driver','jdbc:mysql://servername:portnumber/databasename?serverTimezone=UTC&')
Other approach is to configure the MySQL server to set a recognized timezone.
Thanks

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!