当前位置: 首页 > 知识库问答 >
问题:

hibernate配置:我已经设置了usessl=false,但仍然收到警告

商柏
2023-03-14
<?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,但仍然收到警告:

警告:不建议在没有服务器身份验证的情况下建立SSL连接。根据MySQL 5.5.45+、5.6.26+和5.7.6+的要求,如果未设置显式选项,默认情况下必须建立SSL连接。为了符合不使用SSL的现有应用程序,verifyServerCertificate属性设置为'false'。您需要通过设置usessl=false来显式禁用SSL,或者设置usessl=true并为服务器证书验证提供truststore。

共有1个答案

墨寂弦
2023-03-14

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

 类似资料: