MariaDB
<dependency>
<groupId>org.eclipse.store</groupId>
<artifactId>afs-sql</artifactId>
<version>2.1.0</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("storage"));
Configuration
When using external configuration MariaDB can be set as follows. Please note that you have to define a data source provider.
eclipsestore.properties
# optional, enforces checks
storage-filesystem.target=sql.mariadb
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 org.eclipse.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
}
}
Depending on the amount of data and transactions, charges may apply depending on service usage. Please check with your service provider for details. |