Saturday, October 22, 2011

How to Refresh a Connection Pool Within OC4J 10.1.3.x Remotely.

Visit the Below Website to access unlimited exam questions for all IT vendors and Get Oracle Certifications for FREE
http://www.free-online-exams.com

Problem:    How to Refresh a Connection Pool Within OC4J 10.1.3.x Remotely.

Solution:



Software Requirements/Prerequisites
OC4J 10.1.3.3.0
Configuring the Sample Code
  1. Follow the steps from Note:734463.1
    ConnectionPoolRefresher.zip
  2. Modify class ConnectionPoolRefresh, by adding a new main method (see details below). Or download the new version from here ConnectionPoolRefresherV2.0.zip
Running the Sample Code
java -classpath lib\connectionpoolrefresher.jar;%ORACLE_HOME%/j2ee/home/admin_client.jar oracle.support.oc4j.standalone.ConnectionPoolRefresher
Caution
This sample code is provided for educational purposes only and not supported by Oracle Support Services. It has been tested internally, however, and works as documented. We do not guarantee that it will work for you, so be sure to test it in your environment before relying on it.
Proofread this sample code before using it! Due to the differences in the way text editors, e-mail packages and operating systems handle text formatting (spaces, tabs and carriage returns), this sample code may not be in an executable state when you first receive it. Check over the sample code to ensure that errors of this type are corrected.
Sample Code
The note example calls class PeriodicConnectionPoolRefresher main method, which creates class ConnectionPoolRefresh, which does the refresh work, and uses a ScheduledExecutorService to repeat the execution.

To have this run once, modify class ConnectionPoolRefresh, by adding a new main method, which you can call directly.

This should look like the following:
public static void main(String[] args) {
  //runs once
  Properties myProperties = new Properties();
  String poolName = null;
  String applicationName = null;
  ConnectionPoolRefresh test;
  try {
    myProperties.load(new FileInputStream("refreshpool.properties"));
    poolName = myProperties.getProperty("connectionPoolName");
    applicationName = myProperties.getProperty("applicationName");
    test = new ConnectionPoolRefresh(poolName, applicationName);
    test.run();
  }
  catch (Exception e) {
    e.printStackTrace();
  }
}

Then call:
 java -classpath lib\connectionpoolrefresher.jar;%ORACLE_HOME%/j2ee/home/admin_client.jar oracle.support.oc4j.standalone.ConnectionPoolRefresher

to execute once (you can also modify the ant script to invoke this class instead)

References:
Note 852972.1: How to Refresh a Connection Pool Within OC4J 10.1.3.x Remotely.



Get Oracle Certifications for all Exams
Free Online Exams.com

No comments: