天天看点

jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection 问题

具体描述 nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unknown initial character set index ‘255’ received from server. Initial client character set can be forced via the ‘characterEncoding’ property.)

首先,确定你的mysql版本,8及以上的话:

url=jdbc:mysql://localhost:3306/数据库名?useSSL=false&serverTimezone=CTT

driverClass=com.mysql.cj.jdbc.Driver

然后,将maven pom 文件里的依赖改为:

mysql

mysql-connector-java

runtime

8.0.13