mariadb-connector-j-install

Installs and configures the MariaDB Connector/J JDBC driver with Maven, Gradle, and TLS settings.

28|115|Updated Jan 28, 2025
One-click install
npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-connector-j-install-mariadb-corporation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mariadb-connector-j-install
Source: https://github.com/mariadb-corporation/mariadb-docs/tree/main/agent-skills/granular/connectors/mariadb-connector-j-install
Command: npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-connector-j-install-mariadb-corporation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding the MariaDB JDBC driver to a Java project involves several non-obvious details: the correct Maven coordinates, the jdbc:mariadb: URL scheme requirement in 3.x, the missing transitive JNA dependency for Unix sockets, and TLS that stays disabled unless sslMode is set explicitly. This Skill prevents those misconfigurations. ## Core Features & Use Cases - Build Integration: Provides the exact Maven and Gradle coordinates org.mariadb.jdbc:mariadb-java-client and the driver class org.mariadb.jdbc.Driver, plus guidance on which release series supports which Java version. - Connection and TLS Configuration: Explains the jdbc:mariadb: URL scheme, the permitMysqlScheme option, and the sslMode values (disable, trust, verify-ca, verify-full) with certificate, truststore, and keystore options. - Pooling and Optional Dependencies: Covers MariaDbPoolDataSource, external pool setup with HikariCP, and the JNA dependencies required for Unix domain sockets and Windows named pipes. - Use Case: When wiring a new Java service to MariaDB, use this Skill to add the driver to the build, compose a TLS-enabled connection URL with sslMode=verify-full, and configure a connection pool correctly on the first attempt. ## Quick Start Add the MariaDB Connector/J dependency to my Maven project and show me a TLS-enabled JDBC connection URL for production.

Frequently Asked Questions about mariadb-connector-j-install

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add the MariaDB JDBC driver to Maven or Gradle?▼

Add the dependency org.mariadb.jdbc:mariadb-java-client with the desired version, for example 3.5.9, to your pom.xml or build.gradle. The driver class is org.mariadb.jdbc.Driver, and service loading registers it automatically without Class.forName.

How do I enable TLS with MariaDB Connector/J?▼

Set sslMode in the JDBC URL because it defaults to disable. Use sslMode=trust to confirm the server offers TLS, then move to sslMode=verify-full with serverSslCert pointing to a CA certificate file, classpath resource, or inline certificate text.

Why does jdbc:mysql:// not work with MariaDB Connector/J 3.x?▼

From version 3.0 onward the driver accepts only the jdbc:mariadb: URL scheme by default. The jdbc:mysql: scheme works only when the permitMysqlScheme option is present in the URL.

Does MariaDB Connector/J support Java 8?▼

Yes, the 3.5, 3.4, and 3.3 release series all run on Java 8, 11, 17, 21, and 25. New projects should start on the 3.5 line rather than the legacy 2.7 series.

Why do Unix domain sockets fail with ClassNotFoundException?▼

JNA is not a transitive dependency of the driver. Unix domain sockets and Windows named pipes require the application to add net.java.dev.jna:jna and net.java.dev.jna:jna-platform version 4.2.1 or later; plain TCP connections need neither.

What is the difference between MariaDbDataSource and MariaDbPoolDataSource?▼

MariaDbDataSource opens a fresh connection on every getConnection() call, while MariaDbPoolDataSource is the built-in pool that cleans connection state on release and drops idle connections. With external pools like HikariCP, set driverClassName to org.mariadb.jdbc.Driver.