Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
<title>MariaDB | Ebean ORM</title>
<meta name="layout" content="_layout2/base-docs.html"/>
<meta name="bread1" content="Database platforms" href="/docs/database"/>
<meta name="bread2" content="MariaDB" href="/docs/database/mariadb"/>
<#assign n0_docs="active">
<#assign n1_platforms="active">
<#assign n2_mariadb="active">
Since 12.3.6 MariaDB has it's own platform with SQL2012 History support and DDL generation to support that.
<h3>MariaDB JDBC Driver - useLegacyDatetimeCode</h3>
The expectation is that the MariaDB JDBC driver is used and that <code>useLegacyDatetimeCode=false</code>
is set. This ensures the JDBC driver honours the database server timezone. ebean-test will automatically
set the useLegacyDatetimeCode parameter for but otherwise we need to ensure that parameter is set on
the connection pool.
<pre content="properties">
## example manually setting useLegacyDatetimeCode in properties file
It is expected that the MariaDB JDBC Driver is used.
<pre content="xml">
To test against MariaDB docker test container set the <em>platform</em> to <code>mariadb</code> in
Refer to <a href="/docs/testing">docs / testing</a> if application-test.yaml doesn't exist yet.
<pre content="yml">
platform: mariadb
ddlMode: dropCreate # none | dropCreate | migrations | create
dbName: my_app
The above will use the following defaults:
<table class="compact w100">
<h2 id="ebean-mariadb">ebean-mariadb dependency</h2>
We can use the <code>io.ebean:ebean-mariadb</code> dependency rather than <code>io.ebean:ebean</code> if we want to only
bring in the MariaDB specific platform code. Depending on <code>io.ebean:ebean</code> will bring in all platforms.
<h2 id="types">Types</h2>
UUID is not a native MariaDB type and can be mapped to either BINARY(16) or VARCHAR(36).
We can use <code>@DbJson</code> to map content.
<h2 id="history">History support</h2>
MariaDB has native SQL2011 history support and Ebean will generate DDL to enable and use this
on entities annotated with <code>@History</code>.
<h2 id="start-docker">Docker container</h2>
We can programmatically start a MariaDB docker container using <code>ebean-test-docker</code> via:
<pre content="java">
package main;
import io.ebean.docker.commands.MariaDBContainer;
public class Main {
public static void main(String[] args) {
MariaDBContainer container = MariaDBContainer.newBuilder("10.5")
<@next_edit "SQL Server" "/docs/database/sqlserver" "/docs/database/mariadb/index.html"/>