Apache DbUtils工具的一点浅见
QueryRunner run = new QueryRunner( dataSource ); try{
// Execute the SQL update statement and return the number of
// inserts that were made
int inserts = run.update( "INSERT INTO Person (name,height) VALUES (?,?)",
"John Doe", 1.82 );
// The line before uses varargs and autoboxing to simplify the code
// Now it's time to rise to the occation...
int updates = run.update( "UPDATE Person SET> 2.05, "John Doe" );
// So does the line above
}
catch(SQLException sqle) {
// Handle it
}
页:
[1]