spring连接数据库的url配置:
数据库 mysql8.0
<property name="url" value="jdbc:mysql://localhost/spring?characterEncoding=utf8&serverTimezone=UTC&useSSL=FALSE"/>
分割符写分号 ; 也会报错,写 & 也会报错。
我的版本是写 & ;才是正确的分隔符格式(没有空格)。
时区 serverTimezone=UTC
不加 useSSL=FALSE 会出现以下报错。
BEGIN NESTED EXCEPTION
javax.net.ssl.SSLException
MESSAGE: closing inbound before receiving peer’s close_notify
STACKTRACE:
javax.net.ssl.SSLException: closing inbound before receiving peer’s close_notify
at sun.security.ssl.Alert.createSSLException(Alert.java:133)
at sun.security.ssl.Alert.createSSLException(Alert.java:117)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:340)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:296)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:287)
at sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:737)
at sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:716)
at com.mysql.cj.protocol.a.NativeProtocol.quit(NativeProtocol.java:1312)
at com.mysql.cj.NativeSession.quit(NativeSession.java:182)
at com.mysql.cj.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:1750)
** END NESTED EXCEPTION **