mySQL connection with JDBC driver and timezone error

10 ビュー (過去 30 日間)
funnym0nk3y
funnym0nk3y 2019 年 8 月 22 日
回答済み: Arpan Badeka 2019 年 8 月 22 日
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.

回答 (1 件)

Arpan Badeka
Arpan Badeka 2019 年 8 月 22 日
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

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by