This page provides examples that show how the DbUtils component may be used.
The core classes/interfaces in DbUtils are
QueryRunner
and
ResultSetHandler.
The following example demonstrates how these classes are used together.
DataSource ds = // somehow get DataSource;
// Step 1.
QueryRunner run = new QueryRunner(ds);
// Step 2.
ResultSetHandler h = new BeanHandler(Person.class);
// Step 3.
Person p = (Person) run.query("SELECT * FROM Person WHERE name=?", "John Doe", h);
Explanation