Tue Jan 21 22:19:40 CST 2020 WARN: Caught while disconnecting…
EXCEPTION STACK TRACE:
** 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 java.base/sun.security.ssl.Alert.createSSLException(Alert.java:133)
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:307)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:263)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:254)
at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:645)
at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:624)
at com.mysql.cj.protocol.a.NativeProtocol.quit(NativeProtocol.java:1319)
at com.mysql.cj.NativeSession.quit(NativeSession.java:182)
at com.mysql.cj.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:1750)
at com.mysql.cj.jdbc.ConnectionImpl.close(ConnectionImpl.java:720)
at cn.wbslz.jdbc.JdbcDemo1.main(JdbcDemo1.java:27)
** END NESTED EXCEPTION **
Process finished with exit code 0
解决方法 :
在获取url最后加上&useSSL=false
即可:
jdbc:mysql://localhost:3306/db3?serverTimezone=GMT%2B8&useSSL=false
//3,获得数据库连接对象Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/db3?serverTimezone=GMT%2B8&useSSL=false", "root", "你的密码");