DBCP XAMPP 不接受我的时区

DBCP XAMPP does not accept my timezone

当我尝试在 java 中使用 DBCP 连接到我的 xampp mysql 数据库时,出现此错误:

Caused by: com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value 'West-Europa (standaardtijd)' 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 specifc time zone value if you want to utilize time zone support.

我尝试了很多方法,但似乎无法修复它。这是我用来连接到我的数据库的代码:

BasicDataSource ds = new BasicDataSource();
ds.setUsername("root");
ds.setPassword("");
ds.setUrl("jdbc:mysql://localhost/portfolio");

尝试在连接字符串中明确指定服务器时区:

jdbc:mysql://localhost/portfolio?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC