H2 database
Default database (mainly for development and testing purposes) is H2 database.
There is defined Spring profile H2 for using H2 DB.
H2 database is running in embedded (local) mode with database name openHubDB by default (in-memory mode is used for unit tests only). H2 configuration is in the file application-h2.properties:
spring.datasource.url=jdbc:h2:~/openHubDB spring.datasource.username=sa spring.datasource.password=
There is spring.datasource.initialize=true in application-h2.properties = DB script defined by spring.datasource.data parameter is executed (classpath:/db/db_init-configuration.sql in this case).
This setting is useful for running OpenHub for the first time but should be switched to false value for next runs. Otherwise unique constraint violation errors occur.
If there is needed to see records in in-memory database during OpenHub running then there are the following possibilities.
H2 console
H2 console is web browser based application that is configured on 8082 port.
<bean id="h2WebServer" class="org.h2.tools.Server" factory-method="createWebServer" init-method="start" destroy-method="stop"> <constructor-arg value="-web,-webAllowOthers,-webPort,8082"/> </bean>
H2 console is available only when the following Spring profiles are active: h2, dev
Login page:
Select messages:
JDBC via TCP
It's possible to connect H2 OpenHub in-memory DB if H2 server is configured.
<bean id="h2Server" class="org.h2.tools.Server" factory-method="createTcpServer" init-method="start" destroy-method="stop" depends-on="h2WebServer"> <constructor-arg value="-tcp,-tcpAllowOthers,-tcpPort,9092"/> </bean>
Login in SQuirrel: