MySQL database version is 8.0.11.
To use the drive: Com.mysql.cj.jdbc.Driver
The most important is the connection URL of the database.
After a long day to understand the problem:
Add parameters after the database URL:
Jdbc:mysql://localhost:3306/taobao?characterencoding=utf-8&servertimezone=utc& Usessl=false
In addition, the configuration and XML configuration in the properties file should be noted: connection symbols:
Config in XML: need to use escape character:& instead of &
< bean id = "DataSource" class = "Com.alibaba.druid.pool.DruidDataSource" Destroy-method = "Close" > < property name = "url" value = "Jdbc:mysql://localhost:3306/taobao?characterencoding=utf-8 & SERVERTIMEZONE=UTC &Usessl=false " /> < Propertyname= "username"value= "root" /> < Propertyname= "Password"value= "AAAAAA" /> < Propertyname= "Driverclassname"value= "Com.mysql.cj.jdbc.Driver" /> < Propertyname= "Maxactive"value= "Ten" /> < Propertyname= "Minidle"value= "5" /> </Bean>
In the properties, you cannot use the escape character and use:& directly
Jdbc.driver=com.mysql.cj.jdbc.driverjdbc.url=jdbc:mysql://localhost:3306/taobao?characterencoding=utf-8 &servertimezone=utc&UseSSL=falsejdbc.username=rootjdbc.password= AAAAAA
I've been wasting my time!
Problems with configuring database connections in the SSM framework