Download and Install MariaDB Connector/J
The most recent Stable (GA) release of MariaDB Connector/J is:
MariaDB Connector/J 3.5.0
Contents
Installing MariaDB Connector/J with a Package Manager
The recommended way to install MariaDB Connector/J is to use a package manager like Maven or Gradle.
Installing MariaDB Connector/J with Maven
To install MariaDB Connector/J with Maven, add the following dependency to your pom.xml
configuration file:
<dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> <version>$VERSION</version> </dependency>
Be sure to replace $VERSION
with a valid MariaDB Connector/J version number. See About MariaDB Connector/J: Java Compatibility to determine which MariaDB Connector/J release series supports your Java version.
Installing MariaDB Connector/J with Gradle
To install MariaDB Connector/J with Gradle, add the following dependency to your build.gradle
configuration file:
implementation 'org.mariadb.jdbc:mariadb-java-client:$VERSION'
Be sure to replace $VERSION
with a valid MariaDB Connector/J version number. See About MariaDB Connector/J: Java Compatibility to determine which MariaDB Connector/J release series supports your Java version.
Installing MariaDB Connector/J Manually with the JAR File
It is not generally the recommended method, but MariaDB Connector/J can also be installed by manually installing the .jar
file to a directory in your CLASSPATH
.
MariaDB Connector/J .jar
files can be downloaded from the following URL:
Installing MariaDB Connector/J from Source
This section deals with building the connector from source and testing it. If you have downloaded a ready-built connector, in a jar file, then this section may be skipped.
The source code is available at the mariadb-connector-j repository on GitHub. You can clone it by executing the following:
git clone https://github.com/MariaDB/mariadb-connector-j.git
If you would prefer a packages source tarball release, then MariaDB Connector/J .jar
source code tarballs can be downloaded from the following URL:
MariaDB Connector/J has the following build requirements:
- Maven
- Java JDK
If you would like to run the unit tests, then you'll need a MariaDB or MySQL server. It has to meet the following requirements:
- It must be listening on
localhost
on TCP port3306
. - It must have a database called
testj
. - It must have a
root
user account with an empty password.
If you would like to build MariaDB Connector/J and run the unit tests, then execute the following:
mvn package
If you would like to build MariaDB Connector/J without running the unit tests, then execute the following:
mvn -Dmaven.test.skip=true package
Once the build is complete, you should have a .jar
file with a name like mariadb-java-client-x.y.z.jar
in the target
subdirectory.