public static final class H2ConnectionConfiguration.Builder extends Object
H2ConnectionConfiguration instances.
This class is not threadsafe
| Constructor and Description |
|---|
Builder() |
public H2ConnectionConfiguration build()
H2ConnectionConfiguration.H2ConnectionConfigurationpublic H2ConnectionConfiguration.Builder file(String path)
~/my-database or /path/to/my/database.db.path - of the database file (automatically prefixed with file:)H2ConnectionConfiguration.Builderpublic H2ConnectionConfiguration.Builder inMemory(String name)
my-test-database.
A in-memory database is shut down if the last connection gets closed. To avoid this behavior, configure either the
H2ConnectionOption.DB_CLOSE_DELAY option through property(H2ConnectionOption, String) or use the H2ConnectionFactory.inMemory(String) connection factory to close
the in-memory database by closing CloseableConnectionFactory externally.
name - of a private, in-memory database (automatically prefixed with mem:)H2ConnectionConfiguration.Builderpublic H2ConnectionConfiguration.Builder tcp(String host, String path)
host - - hostname of the remote database (can be localhost)path - - path of the database, e.g. ~/test resolves to {user.home}/test.dbH2ConnectionConfiguration.Builderpublic H2ConnectionConfiguration.Builder tcp(String host, int port, String path)
host - - hostname of the remote database (can be localhost)port - - port the database is serving frompath - - path of the database, e.g. ~/test resolves to {user.home}/test.dbH2ConnectionConfiguration.Builderpublic H2ConnectionConfiguration.Builder option(String option)
DB_CLOSE_DELAY=10, prefixed with ";".option - to append at the end using a ; prefix.H2ConnectionConfiguration.Builderpublic H2ConnectionConfiguration.Builder property(String option, String value)
option - the option key.value - the option value.H2ConnectionConfiguration.Builderpublic H2ConnectionConfiguration.Builder property(H2ConnectionOption option, String value)
H2ConnectionOption.option - the option key enumvalue - the option valueH2ConnectionConfiguration.Builderpublic H2ConnectionConfiguration.Builder password(@Nullable CharSequence password)
password - the passwordH2ConnectionConfiguration.Builderpublic H2ConnectionConfiguration.Builder url(String url)
jdbc:h2: prefix. For in-memory and file-based databases, must include the proper prefix (e.g. file: or mem:).
See https://www.h2database.com/html/features.html#database_url for more details.
url - the urlH2ConnectionConfiguration.BuilderNullPointerException - if url is nullpublic H2ConnectionConfiguration.Builder username(@Nullable String username)
username - the usernameH2ConnectionConfiguration.BuilderCopyright © 2022. All rights reserved.