How to Improve the Performance of Oracle JDBC

Source: Internet
Author: User

This article mainly describes how to greatly improve the performance of Oracle JDBC programs by using the connection and statement pool features. We generally use pool technologies, such as connection pool and statement pool, to significantly improve the performance of database-intensive applications, because this can achieve Object reuse, you do not need to spend time and resources to recreate objects.

If the application frequently interacts with the database and often uses the same parameters to establish a new connection, reuse the database connection object that indicates the physical database connection used by the application can significantly improve the performance. Otherwise, if the application is rarely connected to its basic database, you will not benefit from using the connection pool. In fact, if the pool settings, such as the maximum or minimum number of connections allowed, are optimized for specific applications, many database-intensive applications can benefit from using the connection pool.

Like the connection pool, the statement pool is also used to improve application performance. You can further improve the performance by executing the statement pool multiple times during the application running. However, we should realize that the statement pool is not a panacea for solving performance problems. If each statement is cached and the number of times it is executed in the program is not identified, no performance improvement is possible.

In fact, because storing statements in the cache and saving them in the cache results in overhead, caching statements that are executed only once during program execution reduces performance.

This article describes how to use the connection pool and statement pool to improve the performance of the data-intensive Java database connection (JDBC) program that interacts with the Oracle database through the Oracle JDBC thin driver. This article will introduce Oracle Universal Connection Pool (UCP) for JDBC, which provides a full-featured Connection Pool implementation for caching JDBC connections.

Finally, this article will discuss how to benefit from using the statement pool. We need to take advantage of the features of the Oracle-specific JDBC driver and the new JDBC 4.0 method, these methods have been added to the Statement interface and are available in Oracle JDBC drivers that support Java Development Kit (JDK) 1.6 and later versions.

Set the Work Environment

To use the example in this article and access the Oracle database, you need to install the following software components on your development computer. For details, see "Download" the portlet for a link ):

JDK 1.6

Supports Oracle JDBC thin driver in JDK 1.6

General Oracle connection pool Library

Oracle JDBC thin driver is a Type iv jdbc driver, which means it is independent of the platform and does not require any additional Oracle software on the client that interacts with the Oracle database. Therefore, you can download the JAR file containing the corresponding thin driver version category from the JDBC driver download page, and then install the driver on your computer, you do not need to install/upgrade any other Oracle software. To install the driver, you only need to copy the JAR file to the local file system and include the JAR paths in the CLASSPATH environment variables. For example, you may include the following paths:

 
 
  1. ORACLE_HOME/jdbc/lib/ojdbc6.jar ORACLE_HOME/jlib/orai18n.jar 

If the Oracle database has been installed on your computer, the thin driver has been installed on your computer along with the Oracle database. However, since the thin driver is independent of any other Oracle software, you can find it on the JDBC driver download page by using the corresponding JAR file) upgrade the driver to the latest version.

UCP is a new feature that introduced Oracle Database 11 GB from version 11.1.0.7. This feature has been included in Oracle Application Server since version 11g 1st. If you are using a JAR file without UCP loaded, the file name is ucp. jar), or you want to upgrade to the latest UCP version, you can obtain the UCP from the ucp download page of the Oracle database. jar. This package contains the UCP class to enable this feature in the class path. The included path may be as follows:

 
 
  1. ORACLE_HOME/ucp/lib/ucp.jar 

The above content is a description of high-performance Oracle JDBC, hoping to help you in this regard.
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.