1. 程式人生 > >JDBC連線池技術(c3p0)配置警告問題

JDBC連線池技術(c3p0)配置警告問題

學習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>

配置後可關閉安全連線的設定,將不會再出現警告資訊。