MariaDB
<dependency>
<groupId>one.microstream</groupId>
<artifactId>microstream-afs-sql</artifactId>
<version>05.00.02-MS-GA</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.7.1</version>
</dependency>
MariaDbDataSource dataSource = new MariaDbDataSource();
dataSource.setUrl("jdbc:mysql://host:3306/mydb");
dataSource.setUser("user");
dataSource.setPassword("secret");
SqlFileSystem fileSystem = SqlFileSystem.New(
SqlConnector.Caching(
SqlProviderMariaDb.New(dataSource)
)
);
EmbeddedStorage.start(fileSystem.ensureDirectoryPath("microstream_storage"));
Configuration
When using external configuration MariaDB can be set as follows. Please note that you have to define a data source provider.
microstream-storage.properties
storage-filesystem.sql.mariadb.data-source-provider=com.sample.MyDataSourceProvider
storage-filesystem.sql.mariadb.catalog=mycatalog
storage-filesystem.sql.mariadb.schema=myschema
storage-filesystem.sql.mariadb.url=jdbc:mysql://host:3306/mydb
storage-filesystem.sql.mariadb.user=username
storage-filesystem.sql.mariadb.password=secret
MyDataSourceProvider.java
package com.sample;
import one.microstream.afs.sql.types.SqlDataSourceProvider
public class MyDataSourceProvider implements SqlDataSourceProvider
{
public DataSource provideDataSource(Configuration configuration)
{
String url = configuration.get("url");
String user = configuration.get("user");
String password = configuration.get("password");
// TODO: return data source of your choice, e.g. from a connection pool
}
}