Skip to content

Instantly share code, notes, and snippets.

@fredjoseph
Last active May 31, 2020 10:26
Show Gist options
  • Save fredjoseph/0d9eabb60860b12ba7b7adbfd4d0c558 to your computer and use it in GitHub Desktop.
Save fredjoseph/0d9eabb60860b12ba7b7adbfd4d0c558 to your computer and use it in GitHub Desktop.
[HSQLDB] How to connect with Spring Boot app

In-memory database

For connecting to in-memory HSQL database, we need to launch a db browser in the same JVM instance.

First, we need to add the following code in a Configuration class of the Spring application.

    @PostConstruct
    public void startDBManager() {
        //hsqldb
        DatabaseManagerSwing.main(new String[] { "--url", "jdbc:hsqldb:mem:testdb", "--user", "sa", "--password", "" });
    }

Then, we need to add the following VM arguments -Djava.awt.headless=false when the application is started

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment