Skip to content

Instantly share code, notes, and snippets.

@thomasnield
Last active October 1, 2015 16:24
Show Gist options
  • Save thomasnield/112a9e0cb8041943d4f6 to your computer and use it in GitHub Desktop.
Save thomasnield/112a9e0cb8041943d4f6 to your computer and use it in GitHub Desktop.
@Test
public void hikariTest() {
try {
HikariConfig config = new HikariConfig();
config.setJdbcUrl("jdbc:sqlite://C:/mydatabases/mydb.db");
config.setUsername("bart");
config.setPassword("51mp50n");
config.setMinimumIdle(1);
config.setMaximumPoolSize(5);
HikariDataSource ds = new HikariDataSource(config);
Connection conn = ds.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT count(*) as ct from MY_TABLE");
while (rs.next()) {
System.out.println(rs.getInt("ct"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment