code: public static DataSource createDataSource(String dbName ,boolean initSpatial, String h2Parameters) throws SQLException {
          // Create H2 memory DataSource
          org.h2.Driver driver = org.h2.Driver.load();
          OsgiDataSourceFactory dataSourceFactory = new OsgiDataSourceFactory(driver);
          Properties properties = new Properties();
          String databasePath = initDBFile(dbName, h2Parameters);
          properties.setProperty(DataSourceFactory.JDBC_URL, databasePath);
          properties.setProperty(DataSourceFactory.JDBC_USER, "sa");
          properties.setProperty(DataSourceFactory.JDBC_PASSWORD, "sa");
          DataSource dataSource = dataSourceFactory.createDataSource(properties);
          // Init spatial ext
          if(initSpatial) {
              try (Connection connection = dataSource.getConnection()) {
                  H2GISFunctions.load(connection);
              }
          }
          return dataSource;
      }
docs: Create a database and return a DataSource
  @param dbName
  @param initSpatial
  @param h2Parameters
  @return
  @throws SQLException