基于Data Access Object(DAO)设计模式,利用抽象、接口、类反射技术设计和实现了可重用Java数据库操作组件。它封装了注册和载入JDBC驱动程序、建立数据库连接、运行Structured Query Language(SQL)语句及处理查询结果集、查询结果集的分页显示操作,简化了Java DataBase Connectivity(JDBC)代码的编写,通过编写SQL语句,完成与数据库的交互。它设计的目标是简化中小型Java数据库应用的开发,提高开发的速度和测试的速度,降低数据库应用与数据来源的相关性,实现集中管理数据存取逻辑的功能。它与Struts框架有机结合,可进一步提高开发Web应用的效率。为方便使用它,通过一个例子给予了详细描述。
The module for the database in Java through abstract is designed and Implemented, interface and reflection technique. It encloses the common operations such as registering and loading JDBC driver, building database connection, running SQL and dealing with result sets, paging the record. It simplifies the coding of JDBC and completes the operations of accessing database through writing SQL. It will simplify the development of the database application in Java, make the procedure of the development more easy, decrease the relativity between the database and the application and centralize the management of the data access. It can integrate with Struts model perfectly. This paper will demonstrate how to use this module through a simple example.