java - hibernate 配置 : I have already set useSSL=false, 但仍然收到警告

标签 java mysql hibernate ssl

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <!-- Database connection settings -->
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.url">jdbc:mysql://localhost:3306/schedule?useSSL=false&amp;autoReconnect=true </property>
        <property name="connection.username">root</property>
        <property name="connection.password">1234</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">1</property>

        <!-- SQL dialect -->
        <property name="dialect"
>org.hibernate.dialect.MySQLDialect</property>

        <!-- Enable Hibernate's automatic session context management -->
        <property name="current_session_context_class"
>thread</property>

        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class"
>org.hibernate.cache.NoCacheProvider</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql"
>true</property>

     <property name="format_sql">true</property>

     <property name="hibernate.c3p0.acquire_increment">1</property>
    <property name="hibernate.c3p0.idle_test_period">100</property>
    <property name="hibernate.c3p0.max_size">10</property>
    <property name="hibernate.c3p0.max_statements">10</property>
    <property name="hibernate.c3p0.min_size">10</property>
    <property name="hibernate.c3p0.timeout">100</property>
        <mapping resource="model/modelmap.hbm.xml"/>
    </session-factory>
</hibernate-configuration >

这是我的hibernate配置xml文件,我已经设置了useSSL=false ,但仍然收到警告:

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.



有人可以帮我吗 ?

最佳答案

即使我遇到了同样的错误,问题是 sql-connector 版本和 MySql80 实例不匹配,只要我将连接器版本更新到 8.0.21,问题就解决了......

关于java - hibernate 配置 : I have already set useSSL=false, 但仍然收到警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37898414/

相关文章:

java - 如何检查 JScrollPane 中的 JComponent 是否对用户可见?

mysql - 获取行的最大值或最小值,但忽略空白列或 0

java - 如何在更新jsp页面中的列表时将两个不同的模型属性映射到jsp中的一张表?

java - 在java中使用hibernate将列表类型转换为字符串

java - 添加另一个项目 jar 作为资源

java - 为什么不会发生死锁

java - ArrayList 列表=new ArrayList();列表列表=new ArrayList();两者有什么区别?

mysql - 查找表中与当前行匹配的前一行

MySQL 中的 Java BCryptPasswordEncoder 等价物

java - 使用映射进行 hibernate 一对多查询