mySQL connection with JDBC driver and timezone error

5 visualizaciones (últimos 30 días)
funnym0nk3y
funnym0nk3y el 22 de Ag. de 2019
Respondida: Arpan Badeka el 22 de Ag. de 2019
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.

Respuestas (1)

Arpan Badeka
Arpan Badeka el 22 de Ag. de 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

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by