Skip to content

Instantly share code, notes, and snippets.

@wspeirs
Created January 8, 2014 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wspeirs/8325985 to your computer and use it in GitHub Desktop.
Save wspeirs/8325985 to your computer and use it in GitHub Desktop.
QueryRunner runner = new QueryRunner(dataSource);
try
{
// Execute the SQL insert statement
runner.insert("INSERT INTO Person (name,height) VALUES (:name,:height)")
.bind("name", "John Doe")
.bind("height", 1.82)
.execute();
// Now it's time to rise to the occation...
int updates = runner.update("UPDATE Person SET height=:height WHERE name=:name")
.bind("name", "John Doe")
.bind("height", 2.05)
.execute();
}
catch(SQLException sqle) {
// Handle it
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment