7 Haziran 2023 Çarşamba

JDBC Sürücüleri - MySQL

Giriş
Açıklaması şöyle
The coordinates of the MySQL JDBC driver have changed from mysql:mysql-connector-java to com.mysql:mysql-connector-j.
Daha uzun bir açıklama şöyle
MySQL Connector/J has new Maven Coordinates
For a very long time MySQL Connector/J has been published under the Maven coordinates group ID 'mysql' and artifact ID 'mysql-connector-java'. Neither was fully compliant or been officially ratified.

While a group ID mysql was originally possible, nowadays it would be very difficult to obtain approval to use a single word group ID. Those who still have them are often considered legacy projects. Although Maven does not enforce this rule, the convention says that a group ID should follow Java's package name rules, i.e., it should start with a reversed domain name belonging to the organization that owns the project. For MySQL Connector/J this means it should have been com.mysql all along.

Another unfortunate naming choice was mysql-connector-java for artifact ID. It would have been all fine if only the product was officially named "MySQL Connector/Java" instead of "MySQL Connector/J". The name "connector-java" or "Connector/Java", with or without the preceding word "MySQL" has never considered official by the MySQL Organization. Again, Maven does not enforce any strict rules for naming artifacts but we feel that we should align the artifact ID with the product name so, mysql-connector-j, would have been a better match.

Having said that, starting with version 8.0.31, MySQL Connector/J artifacts can be found under the maven repository directory /com/mysql/mysql-connector-j, with group ID com.mysql and artifact ID mysql-connector-j. Consequently, the corresponding jar files were also renamed to mysql-connector-j-x.y.z.jar in all available distribution packages.

How does this affect your projects?
Projects with a dependency on MySQL Connector/J version 8.0.31 and above, must update their POM dependency settings to:

<dependency>
  <groupId>com.mysql</groupId>
  <artifactId>mysql-connector-j</artifactId>
  <version>8.0.31</version>
  (...)
</dependency>
 
For a limited number of releases the MySQL Connector/J development team will maintain the old Maven coordinates alongside with the new. The old repository will stop getting jar files, though. Instead, only informational files and a relocation POM file will be published under this repository and projects linking to the old Maven coordinates will be redirected to the new ones automatically by the dependency resolution tool of your choice.

Why now?
No reason at all. But why not? In fact there's no publicly visible reason to do this change now. We had the chance to fine tuning some company-internal publishing processes and this was just in the way. The impact for users is not negligible but in the end we just want to do the right thing.

Eski Kullanım
Örnek
Şöyle yaparız
<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>8.0.27</version>
</dependency>
Örnek
Şöyle yaparız. Burada scope runtime veriliyor. Yani derleme için gerekmez ancak çalışmak için gerekir.
<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>8.0.27</version>
  <scope>runtime</scope>
</dependency>

Hiç yorum yok:

Yorum Gönder

CREATE EVENT - Scheduled Task İçindir

Örnek Şöyle yaparız CREATE EVENT myevent     ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR     DO       UPDATE myschema.mytable SET myc...