摘要
JDBC是Java EE应用中数据持久化层的解决方案之一,具有访问速度快的优势,但也存在编写繁琐、复用性低的缺陷。针对上述问题,从JDBC API的使用和代码复用两个方面提出了优化性能的若干方法。JDBC API使用方面的优化方法包括:合理选取数据库驱动程序、使用连接池管理Connection、优化Statement、优化Resultset等。代码复用方面提出一种模板方法模式+DAO+配置文件的访问方法。以Oracle11g数据库和相关测试工具对优化方法进行了实际测试,通过实验数据证明了优化方法的有效性。
JDBC is one of the solutions for data persistence layer in Java EE application,it has the advantages of fast access speed, but it also has the defects of low complexity and low reusability. To above - mentioned problem, several methods for optimizing the perform- ance of JDBC are proposed from two aspects of the use of JDBC API and code reuse. The optimization methods of JDBC API include : a reasonable selection of database drivers, the use of connection pool management Connection, optimization of Statement, optimization of Resuhset, etc. From the aspect of code reuse, proposes a access method that is template method pattern + DAO + configuration file. Uses Oraelel lg database and related testing tools to test the above optimization methods,the validity of the optimization method is proved by the experimental data.
出处
《网络新媒体技术》
2016年第5期9-15,共7页
Network New Media Technology
基金
陕西省教育厅科研计划项目(14JK1796)
咸阳师范学院专项科研基金项目(14XSYK038)
关键词
JDBC
数据持久化层
性能优化
数据库连接池.设计模式
JDBC, Data Persistence Layer, Performance Optimization, Database Connection Pool, Design Pattern