dbutils
If we only use JDBC for development, we will find that there is too much redundant code, in order to simplify JDBC development, we use the Apache Commons component A member:dbutils.
Dbutils is a practical tool for database operations in Java Programming, small and simple.
The dbutils encapsulates the operation of JDBC , simplifies JDBC operations, and can write less code.
dbutils three core functions
- The API for SQL Statement operations is provided in Queryrunner .
- The Resultsethandler interface, which defines how the result set is encapsulated after a select operation .
- The dbutils class, which is a tool class that defines how to close resources and transaction processing
Queryrunner Core class
-
Update (Connection conn, String sql, Object ... params) , used to complete table data additions, deletions, update operations
-
Query (Connection conn, String sql, resultsethandler<t> rsh, Object ... params) for querying operations that complete table data
Java--dbutils