Last active
December 22, 2015 19:49
-
-
Save brianm/6521592 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try (EmbeddedPostgreSQL db = EmbeddedPostgreSQL.start()) { | |
try (Handle h = DBI.open(db.getPostgresDatabase())) { | |
h.execute("CREATE DATABASE breakfast"); | |
h.execute("CREATE USER brianm with password 'secret'"); | |
h.execute("grant all privileges on database breakfast to brianm"); | |
} | |
try (Handle h = DBI.open(db.getDatabase("brianm", "breakfast"))) { | |
h.execute("create table food (id serial primary key, name text)"); | |
h.execute("insert into food (name) values ('pancake')"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>com.nesscomputing.components</groupId> | |
<artifactId>ness-pg-embedded</artifactId> | |
<version>2.5.0</version> <!-- 2.5.X is postgres 9.3 --> | |
<scope>test</scope> | |
</dependency> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment