鏈接mysql時出現的異常信息:(com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed t...

鏈接mysql庫報的異常信息:java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near ';allowMultiQueries=true'.java

解決方案:mysql

鏈接的mysql是8.0.11版本,首先更新mysql驅動到對應版本sql

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.11</version>
</dependency>
//原來的URL
private static final String JDBC_URL = "jdbc:mysql://127.0.0.1:3306/db_ext_test?characterEncoding=UTF-8&amp;allowMultiQueries=true"; //改後的URL: // 指定時區:serverTimezone=GMT // 指定是否用ssl鏈接:useSSL=false
private static final String JDBC_URL1 = "jdbc:mysql://127.0.0.1:3306/db_ext_test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT";
相關文章
相關標籤/搜索