跳至主要內容

开源协议与 mariadb-java-client

小于 1 分钟

开源协议与 mariadb-java-client

GPL 与 LGPL

一般商业项目中,我们需慎重使用 LICENSEGPL 的开源组件。

从 mysql-connector-java 到 mariadb-java-client

<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.31</version>
</dependency>

mysql-connector-javaLICENSEGPLv2。需要替换为 mariadb-java-client

<!-- https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client -->
<dependency>
    <groupId>org.mariadb.jdbc</groupId>
    <artifactId>mariadb-java-client</artifactId>
    <version>3.0.8</version>
</dependency>

jdbc:mariadb scheme (MariaDB Connector/J 3.0.3 Release Notes)

It occurs that mysql AND mariadb driver are sometimes available in the same classpath, so, now, driver only accept jdbc:mariadb: by default.

If for some reason, connection string is required to be jdbc:mysql: Driver will be used only if connection string contain 'permitMysqlScheme'. example : jdbc:mysql:localhost/test?permitMysqlScheme.

3.0.3 版本之前(不含 3.0.3),用 mariadb-java-client 来连接 MySQL 可以使用 jdbc:mysql:,否则只能使用 jdbc:mariadb:(除非增加 permitMysqlScheme 参数)。

参考链接

(全文完)