Reputation: 3196
I'm running some java on a Linux box whose time zone is:
% timedatectl
...
America/Los_Angeles (PDT, -700)
During MySQLDatabase.getConnection()
I get error:
java.sql.SQLException: The server time zone value 'PDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specific time zone value if you want to utilize time zone support.
I cannot change the server time zone, so I'm looking to tell JDBC about it. Consulting the documentation here it gives me three options, and I am lost attempting to apply them.
Option 1: I'm looking for a setServerTimezone
method on the MysqlDataSource
and find none.
Option 2: I don't seem to be calling either of those methods.
Option 3: I don't have a connection URL either, because I start with MysqlDataSource
, set username etc and get a Connection
from there.
How do I do this?
Upvotes: 0
Views: 4493
Reputation: 77
On my Rasperry Pi I just had to change the time zone in Rasperian.
Hope that will work, Philipp
Upvotes: 0
Reputation: 3196
I have not figured out the answer to the original question, but I have figured out another way of solving it:
/etc/mysql/my.conf
(or equivalent) and add default_time_zone = +0:00
to the [mysqld]
section.mysql
database populated (they always exist, but are empty by default).P.S. There are people at ex-Sun/Oracle who understand API design. What about you dudes, if you read this, run some internal classes to teach those who do not understand yet? And, dear docs people, if you write that X
is a property of Y
in your docs, can you make sure Y.getX()
exists, please?
Upvotes: 1