学习JDBC技术时,发现老提示
Tue Jan 10 20:47:11 CST 2017 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.
大概意思为 在没有服务器确认的情况下,不推荐使用安全连接; 根据以上版本的mysql,安全连接是默认为true的,如果需要修改:
1、将verifyServerCertificate 属性值改为false;
2、搜索了下发现可以在jdbcurl后加入参数 参数值 userSSL=false ,即可关闭安全连接设置;
在学习使用c3p0连接池技术的配置时,在c3p0-config.xml中可以配置:
<c3p0-config>
<default-config>
<property name="driverClass">com.mysql.jdbc.Driver</property>
<property name="jdbcUrl">jdbc:mysql://127.0.0.1:3306/jdbc?useSSL=false</property>
<property name="user">root</property>
<property name="password">root</property>
</default-config>
</c3p0-config>
配置后可关闭安全连接的设置,将不会再出现警告信息。