Skip to content

Instantly share code, notes, and snippets.

@jpoetker
Created May 24, 2013 19:39
Show Gist options
  • Save jpoetker/5645991 to your computer and use it in GitHub Desktop.
Save jpoetker/5645991 to your computer and use it in GitHub Desktop.
try (Connection con = DriverManager.getConnection(JDBC_URL, USER, PASSWORD)) {
try (PreparedStatement query = con.prepareStatement(SQL_SELECT)) {
query.setInt(1, Integer.valueOf(value));
try (ResultSet rs = query.executeQuery()) {
while (rs.next()) {
System.out.println(rs.getString(1));
}
}
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment