1. 程式人生 > 資料庫 >com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connec

com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connec

連線資料庫問題

問題一

: com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL,failed to parse the connection string near ‘;characterEncoding=utf-8’. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
我遇到以上錯誤
原來的URL:

static final String DB_URL = "jdbc:mysql://localhost:3306/loginproject?serverTimezone=UTC&characterEncoding=utf-8";

改後的URL:

static final String DB_URL = "jdbc:mysql://localhost:3306/loginproject?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT";

本人用的 mysql-connector-java 8.0.13.jar,資料庫用的MySQL 8.0的

以後還遇到資料庫來接問題再更新……