H2 Database URLs
Embedded
The URL jdbc:h2:~/test means the database is stored in
the user home directory in files starting with 'test'.
Absolute locations like jdbc:h2:/data/db/test are supported.
In embedded mode, the database runs in the same process as the application.
Only one process may access a database at any time.
Databases are automatically created if they don't exist
if you have a permission.
URLs of the form jdbc:h2:./data/test are relative to
the current working directory (the directory where the application was started).
It is recommended to use locations relative to ~
or absolute locations.
Remote (client/server)
The URL jdbc:h2:tcp://localhost/~/test means connect
over TCP/IP to the H2 TCP server running on this computer, and open a database
called test in the user home directory. The server must be started first.
Any number of clients can connect to the same database.
The same location rules as for embedded databases apply.
In-Memory
The URL jdbc:h2:mem:test means open an in-memory database
named 'test'. Data is not persisted, and lost when the last connection to the database
is closed. Multiple threads can access the same database, but data is only visible
within the same process.
For more information, see Database URL Overview.