Skip to content

Instantly share code, notes, and snippets.

@dusanstanojeviccs
Created November 5, 2017 22:07
Show Gist options
  • Select an option

  • Save dusanstanojeviccs/70116e3703716bac0545f7ad0fd938ce to your computer and use it in GitHub Desktop.

Select an option

Save dusanstanojeviccs/70116e3703716bac0545f7ad0fd938ce to your computer and use it in GitHub Desktop.
public void update(Book book) throws SQLException {
PreparedStatement preparedStatement = database.getConnection().prepareStatement("update books set title = ?, description = ? where id = ?");
preparedStatement.setString(1, book.getTitle());
preparedStatement.setString(2, book.getDescription());
preparedStatement.setInt(3, book.getId());
preparedStatement.executeUpdate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment