Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql-connector-j vs mysql-connector-java maven dependency differences

What is difference between these two Maven dependencies for connecting to MySQL DB:

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
</dependency>

and

<dependency>
    <groupId>com.mysql</groupId>
    <artifactId>mysql-connector-j</artifactId>
</dependency>
like image 501
Mustafa Poya Avatar asked Jan 28 '26 06:01

Mustafa Poya


1 Answers

TL;DR

Use this

<dependency>
    <groupId>com.mysql</groupId>
    <artifactId>mysql-connector-j</artifactId>
</dependency>

MySQL renamed the connector:

  • https://dev.mysql.com/doc/relnotes/connector-j/en/news-8-0-31.html

You should use MySQL Connector/J.


If you are using the Spring-Boot-3.0 or above then you should use MySQL Connector/J.

The coordinates of the MySQL JDBC driver have changed from mysql:mysql-connector-java to com.mysql:mysql-connector-j. If you are using the MySQL JDBC driver, update its coordinates accordingly when upgrading to Spring Boot 3.0.

Source


Also from the comment @Mar-Z provided this information:

The second one is the correct/current one. The first one is outdated. It will be updated on Maven but for a limited time only. Check here: MySQL Connector/J has new Maven Coordinates

like image 51
Rakesh Soni Avatar answered Jan 29 '26 20:01

Rakesh Soni



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!