Oracle Weblogic connection pool within a JDBC Data Source contains a group of JDBC connections that the application server reserves, uses and then returns to the pool.
The connections in the pool are registered when starting up WebLogic Server or when deploying the data source to a new target.
In order to configure the Connection Pool, select the Data Source from the Console left menu: Services | Data Sources. Here are some of these settings you can apply, explained side by side:
As you can see, Oracle WLS has lots of sophisticated parameters to detect if a Connection is used or not and it is also able to replace faulty connections with new ones or returning to the pool connections which are idle for a fixed amount of time.
A leaked connection is a connection that was not properly returned to the connection pool contained in the Data Source. To automatically recover leaked connections, you can specify a value for Inactive Connection Timeout on the Data Sources | Configuration | Connection Pool page. When you set a value for Inactive Connection Timeout, WebLogic Server forcibly returns a connection to the Data Source when there is no activity on a reserved connection for the number of seconds that you specify.
Using the Statement Cache
When you use a Prepared Statement or Callable Statement in an application, there is considerable processing overhead for the communication between the application server and the database server and on the database server itself. To minimize the processing costs, WebLogic Server can cache prepared and callable statements used in your applications. When an Enterprise application calls any of the statements stored in the cache, WebLogic Server reuses the statement stored in the cache. Reusing prepared and callable statements reduces CPU usage on the database server, improving performance for the current statement and leaving CPU cycles for other tasks.
The parameters available in the statement cache configuration are:
- Statement Cache Type: The algorithm that determines which statements to store in the statement cache. You can opt between LRU and FIXED:
- When you select LRU (Least Recently Used, the default) and the cache is full WebLogic Server determines which existing statement in the cache was the least recently used and replaces that statement in the cache with the new statement.
- When you select FIXED as the Statement Cache Type, WebLogic Server caches prepared and callable statements used on the connection until the statement cache size is reached. When additional statements are used, they are not cached.
- Statement Cache Size: The number of statements to store in the cache for each connection. The default value is 10.
Deploying the Data Source
Once that you have defined all your Connection pool settings, it’s time to make this Data Source available to your applications. This can be achieved by selecting the “Targets” tab menu, which will let you choose on which Weblogic server the Data Source will be deployed.
When you create a JDBC resource (Data Source or multi Data Source) using Weblogic Administration Console or using the WebLogic Scripting Tool (WLST), WebLogic Server creates a JDBC module in the config/jdbc subdirectory of the domain directory and adds a reference to the module in the domain’s config.xml file. The JDBC module conforms to thejdbc-data-source.xsd schema.