Connection connection = null;
Throwable thrown = null;
try {
Class.forName("org.spatialite.JDBC");
SQLiteConfig config = new SQLiteConfig();
config.enableSpatiaLite(true);
connection = DriverManager.getConnection("jdbc:spatialite::memory:",
config.toProperties());
Statement statement = connection.createStatement();
statement.execute("SELECT InitSpatialMetaData();");
} catch (SQLException e) {
thrown = e;
thrown.printStackTrace();