When I try to connect to my xampp mysql database using DBCP in java I get this error:
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.
I have tried numerous things, but I can't seem to fix it. This is the code I use to connect to my database:
BasicDataSource ds = new BasicDataSource();
ds.setUsername("root");
ds.setPassword("");
ds.setUrl("jdbc:mysql://localhost/portfolio");
Try specifying the serverTimezoneexplicitly in the connection string:
jdbc:mysql://localhost/portfolio?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC