Skip to content

Instantly share code, notes, and snippets.

@schneefisch
Last active September 14, 2020 09:10
Show Gist options
  • Save schneefisch/465549fa05c587ce3c890b1faf95e990 to your computer and use it in GitHub Desktop.
Save schneefisch/465549fa05c587ce3c890b1faf95e990 to your computer and use it in GitHub Desktop.
create a new embedded H2 database
EmbeddedDatabase db = new EmbeddedDatabaseBuilder()
.generateUniqueName(true)
.setType(H2)
.setScriptEncoding("UTF-8")
.ignoreFailedDrops(true)
.addScript("schema.sql")
.addScripts("user_data.sql", "country_data.sql")
.build();
// perform actions against the db (EmbeddedDatabase extends javax.sql.DataSource)
db.shutdown();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment