Tag Archives: Mybatis connect to the database error

Using Mybatis to connect to the database error: Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver···

Mybatis connects to a Mysql database with the following warning.
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.

Solution.
In the Mybatis connection database configuration file, modify the connection driver to.

<dataSource type="POOLED">
    <!--change com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver -->
    <property name="driver" value="com.mysql.cj.jdbc.Driver"/>
</dataSource>