SQLite
<dependency>
<groupId>one.microstream</groupId>
<artifactId>microstream-afs-sql</artifactId>
<version>07.01.00-MS-GA</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.32.3</version>
</dependency>
SQLiteDataSource dataSource = new SQLiteDataSource();
dataSource.setUrl("jdbc:sqlite:microstreamdb");
SqlFileSystem fileSystem = SqlFileSystem.New(
SqlConnector.Caching(
SqlProviderSqlite.New(dataSource)
)
);
EmbeddedStorage.start(fileSystem.ensureDirectoryPath("microstream_storage"));
Configuration
When using external configuration SQLite can be set as follows. Please note that you have to define a data source provider.
microstream-storage.properties
storage-filesystem.sql.sqlite.data-source-provider=com.sample.MyDataSourceProvider
storage-filesystem.sql.sqlite.catalog=mycatalog
storage-filesystem.sql.sqlite.schema=myschema
storage-filesystem.sql.sqlite.url=jdbc:sqlite:microstreamdb
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");
// TODO: return data source of your choice, e.g. from a connection pool
}
}