Aiming at the low efficiency of traditional JDBC and EJB database access,and numerous connecting redundancy,we designed and implemented a database access optimization based on AOP and connection pool.The solution can realize a database connection for exclusive control through dynamic proxy technology.At the same time,considering the exceptional situation of database connection,a strategy which can reconnect the database is added.The strategy makes up the deficiency of existing connection pool.To further enhance the efficiency of database access,we propose a transaction processing framework based on AOP,which solves the separation of the business layer and data access and realize CRUD (Creation,Retrieve,Update,and Delete) operation.Application of the solution may benefit reusing and modification of data access,increase data access performance of Web application programs,and greatly improves the efficiency of database access.%针对传统JDBC和EJB访问数据库效率不高,存在大量的数据库连接冗余的问题,设计并实现了一个基于AOP与连接池的数据库访问优化方案.该方案通过动态代理(Proxy)技术,实现对数据库连接进行独占控制,同时考虑到数据库连接的异常情况,加入了一种数据库重连机制策略,弥补现有连接池的不足;为了进一步提高数据库访问效率,提出了基于AOP的事务处理框架,解决业务层和数据存取中分离,实现数据的CRUD(创建、查询、更新和删除)操作.应用本方案有利于数据存取操作的重用和改动,改善了Web应用程序数据库访问性能,极大地提高数据库访问效率.
展开▼