[fix] Loading class com.mysql.jdbc.Driver is deprecated


Java MySQL 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.

If you are working on a JDBC project with Java and MySQL and you get the above warning message in your console is because the DriverManager connection string that you are using to register MySQL has changed and you should be using com.mysql.cj.jdbc.Driver instead of com.mysql.jdbc.Driver

MySQL Driver depricated Warning Java
Solution:

Replace,

com.mysql.jdbc.Driver

with,

com.mysql.cj.jdbc.Driver

Example:
Class.forName("com.mysql.jdbc.Driver");
-


Have Questions? Post them here!

Top Hashtags:

Advertisements

Advertisements




Advertisements