Dbutils 简明教程
Apache Commons DBUtils - Overview
Apache Commons DbUtils 库是一组相当小的类,旨在更容易地处理 JDBC 调用而不泄漏资源,且具有更清晰的代码。由于 JDBC 资源清理相当繁琐且容易出错,因此 DBUtils 类有助于抽象出样板代码,以便开发人员仅能专注于与数据库相关的操作。
Apache Commons DbUtils library is a quite small set of classes, which are designed to make easier JDBC call processing without resource leak and to have cleaner code. As JDBC resource cleanup is quite tedious and error prone, DBUtils classes helps to abstract out the boiler plate code, so that the developers can focus on database related operations only.
Advantages of DBUtils
使用 Apache Commons DBUtils 的优点如下:
The advantages of using Apache Commons DBUtils are explained below −
-
No Resource Leakage − DBUtils classes ensures that no resource leakage happen.
-
Clean & Clear code − DBUtils classes provides clean and clear code to do the database operations without any need to write a cleanup or resource leak prevention code.
-
Bean Mapping − DBUtils class supports to automatically populate javabeans from a result set.
DBUtils Design Principles
Apache Commons DBUtils 的设计原则如下:
The design principles of Apache Commons DBUtils are as follows −
-
Small − DBUtils library is very small in size with fewer classes, so that it is easy to understand and use.
-
Transparent − DBUtils library is not doing much work behind the scenes. It simply takes query and executes.
-
Fast − DBUtils library classes do not create many background objects and is quite fast in database operation executions.