Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver' [duplicate]
This is the Warning im getting in console, Im confused with this 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 1:
I resolved this problem by change application.properties
of
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
to
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
Hope it help
Solution 2:
If you're using Hibernate then change in your "hibernate.cfg.xml" the following:
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
To:
<property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property>
That should do :)
Solution 3:
According Changes in the Connector/J API "The name of the class that implements java.sql.Driver in MySQL Connector/J has changed from com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver. The old class name has been deprecated."
This means that you just need to change the name of the driver:
Class.forName("com.mysql.jdbc.Driver");
to
Class.forName("com.mysql.cj.jdbc.Driver");
Solution 4:
Change driver property in your ORM config file from
<property name="driver" value="com.mysql.jdbc.Driver"/>
to
<property name="driver" value="com.mysql.cj.jdbc.Driver"/>
This will resolve the warning :-)