Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'

Tags:

mysql

jdbc

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. 
like image 286
vicky Avatar asked Aug 27 '18 04:08

vicky


People also ask

Is JDBC deprecated?

jdbc. Driver'. This is deprecated. The new driver class is `com.

Which is now deprecated and will be removed in a future release of connector J?

Deprecation and Removal Notes The TLSv1 and TLSv1. 1 connection protocols are now deprecated.

What exception is thrown if the driver for mysql is not loaded in the classpath?

ClassNotFoundException is a checked exception in Java that occurs when the JVM tries to load a particular class but does not find it in the classpath.


2 Answers

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

like image 163
Wei Chun Avatar answered Oct 07 '22 16:10

Wei Chun


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 :)

like image 37
Yogev Avatar answered Oct 07 '22 14:10

Yogev