How to run H2 database in server mode?

From command line,

java -jar h2-1.3.160.jar -webAllowOthers -tcpAllowOthers

this will launch an h2 database in server mode:

Web Console server running at http://A.B.C.D:8082 (others can connect)
TCP server running at tcp://A.B.C.D:9092 (others can connect)
PG server running at pg://A.B.C.D:5435 (only local connections)

open a browser to have an admin GUI


As the exception message says, "Database may be already in use". You need to close all other connection(s), to make sure the database is not open in another process concurrently.

By the way, don't use AUTO_SERVER=TRUE and the server mode at the same time. See the documentation for the automatic mixed mode. Use either one.

I guess you are a bit confused about the different connection modes. I suggest to read the documentation about the connection modes, to make sure you understand it.

Tags:

Database

Java

H2