異常一:Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
異常二:java.sql.SQLException: The server time zone value '?й???????' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
這是我當(dāng)時配置的數(shù)據(jù)庫地技,一運行就顯示上面錯誤。。。。。
driverClass="com.mysql.jdbc.Driver"??
connectionURL="jdbc:mysql://localhost:3306/ssm_crud"??
userId="root"??
password="142014068">??
解決方法:
第一個異常是因為mysql-connection-java的最新版本不建議使用“com.mysql.jdbc” 包下面的“Driver”,改正方法直接把配置文件中的“com.mysql.jdbc.Driver”改為在異常中提示的“com.mysql.cj.jdbc.Driver”送矩。
? ?第二個異常顯示新版本的數(shù)據(jù)庫連接程序需要指定UTC時區(qū),改正方法將配置文件中的“url”后面加上指定的時區(qū)哪替,將其值改為
jdbc.jdbcUrl=jdbc:mysql://localhost:3306/ssm_crud?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT???
jdbc.driverClass=com.mysql.cj.jdbc.Driver??
jdbc.user=root??
jdbc.password=142014068??