H2 is a Java-based Database which replaced Derby as the default database in Payara 5. Derby as a database service that can be started and managed by Payara Server Enterprise, has been removed starting from version 5.201.
Starting from Payara 5.32.0 H2 Database is started with a password, this password is
changeit. This change is due to upgrading H2 Database to version 1.4.200 and does not affect how you start/stop the database or how you connect to the H2 Console.
In terms of performance, Derby is one of the slowest embedded databases as compared to other H2, PostgresSQL, HSQLDB, etc. H2 also has a smaller disk footprint; the size of a JAR file is around 1.5 MB.
To start the database run the command below:
The above command will start H2 on the default port, which is 9092.
To stop the database run the command below:
The above command will stop H2 by default.
To connect to an H2 DB database and execute SQL scripts, you should:
Stop Payara Server if running
/path/to/payara/payara5/h2db/binto find the h2db binaries
java -jar h2.jar(this will start the H2 Admin UI server and open browser with the Admin UI URL)
In the browser, set JDBC URL to
jdbc:h2:<path to payara>/glassfish/domains/<domainname>/lib/databases/ejbtimerto connect to the EJB timer database (or change the path to connect to another DB)
Leave the other options as they are and log into the SQL console
Make sure to stop the
java -jar h2.jarprocess before launching Payara Server