一直连接不上数据库的可能原因

    科技2026-03-16  8

    检查JDBC的代码

    String url="jdbc:mysql://localhost:3306/weeklyreport

    3306是我自己的数据库端口,weeklyreport是数据库名

    要在后面加上?useSSL=false&serverTimezone=UTC&characterEncoding=UTF-8";

    所以整行代码应变成

    String url="jdbc:mysql://localhost:3306/weeklyreport?useSSL=false&serverTimezone=UTC&characterEncoding=UTF-8";
    Processed: 0.009, SQL: 9