• 学生管理系统调试笔记


    一 、   数据库连接报错:

     

     

     报错信息如下:

    Fri May 06 19:56:07 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

     

     

    此时的数据库连接如下:

     

    public Connection getCon() {

    try {

    Class.forName("com.mysql.jdbc.Driver");

    String url = "jdbc:mysql://127.0.0.1/medicalsystem?useUnicode=true&characterEncoding=utf-8";

    String user = "root";

    String password = "123456";

    Connection conn = DriverManager.getConnection(url, user, password);

     

    return conn;

    } catch (Exception e) {

    e.printStackTrace();

    return null;

    }

     

     

    调试:

     

    这是数据库连接的问题,虽然以上的数据库连接没有问题,但有可能某个程序就是不能运行,那么这样的话,根据报错提示,设置useSSL=false就可以了。

    s

    String url = "jdbc:mysql://127.0.0.1/medicalsystem?useUnicode=true&characterEncoding=utf-8&useSSL=false";

     

     

    二 、Date型在接受参数时,可以直接定义成String型,但是在存入数据库中时要将空的字符串设置成null,否则无法存入数据库中。

     

     

     





  • 相关阅读:
    在Selenium自动化中查找损坏的链接
    WebDriverManager
    在TestNG中重试失败的测试
    算法:汉诺塔
    Java 多线程
    spring ioc原理(看完后大家可以自己写一个spring)
    Apache与Nginx的区别
    Apache与Nginx的区分比较
    Java 设计模式
    Java 理论与实践: 正确使用 Volatile 变量
  • 原文地址:https://www.cnblogs.com/Yasha/p/412f9024638c9820119fab58e82b68ac.html
Copyright © 2020-2023  润新知