Mybatis – Plus was used in my project, but MP removed the performance analysis plugin in version 3.2.0 and above, and used P6Spy instead, well, configuration is very simple, after all, SpringBoot, a copy and paste, done, run, and then gorgeous error:

org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection: dbType not support : null, url jdbc:p6spy:mysql://localhost:3306/weimi? allowMultiQueries=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&useAffectedRows =true&tinyInt1isBit=false&useTimezone=true&serverTimezone=UTCCopy the code

DbType is not supported. What is not supported? Doubt is the reason of mysql8, hence to 5.5, the error remains, and doubt is the cause of the connection pool, then through Druid document, see the following:

What databases does WallFilter currently support? WallFilter uses different SQL Parser and related configuration information for different databases, and strives to fully understand its SQL semantics, so as to make more accurate defense means. Druid currently supports mysql, Oracle, SQL Server, and Postgres.Copy the code

So either disable Druid’s wallFilter or switch to the data source.

Closing Method 1:

In your DruidConfig file (if any) you should have something like this:

List<Filter> filters = new ArrayList<>();
filters.add(wallFilter());Copy the code

Annotation.

Closing Method 2:

Application. Properties

spring.datasource.druid.filters=stat,wallCopy the code

Just get rid of wall.

It is worth noting that the driver-class-name for mysql8.x and mysql5.x is different, but there is no need to write com.mysql.cj.jdbc.driver in the spy.properties configuration file for P6Spy, it will recognize it automatically.