This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

Download and Install MariaDB Connector/J

The most recent Stable (GA) release of MariaDB Connector/J is:
MariaDB Connector/J 3.5.0

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.

Gradle configuration.

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:

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 port 3306.
  • 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.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.