All Examples This Package
Class examples.jdbc.t3client.refreshpool
java.lang.Object
|
+----examples.jdbc.t3client.refreshpool
- public class refreshpool
- extends Object
This example demonstrates how to set up automatic checking of
connections in any WebLogic JDBC connection pool that you have registered
in the weblogic.properties file.
To set up this example:
- Set up your development shell as described in Setting up your environment.
- Compile the example by executing the following command in your development shell:
$ javac -d %CLIENT_CLASSES% refreshpool.java
- Start WebLogic Server in a separate shell.
- Run this example by executing the following command in your
development shell. The arguments are explaned under main(), in the
Method section.
$ java examples.jdbc.t3client.refreshpool
WebLogicHost:port WebLogicPassword POOLNAME #minutes SQL
- Author:
- Copyright (c) 1996-1999 by BEA WebXpress, Inc. All Rights Reserved.
-
refreshpool()
-
-
main(String[])
- In the main of this example, we first retrieve arguments from
the user that set the following:
- URL of the WebLogic Server
- Password for the WebLogic Server
- Name of the connection pool as registered in the
weblogic.properties file
- Interval at which the connections should be tested
to see if they need to be refreshed
- A simple SQL statement, one that is guaranteed to succeed
under any circumstances so long as there is a working connection
to the DBMS.
refreshpool
public refreshpool()
main
public static void main(String[] argv) throws Exception
- In the main of this example, we first retrieve arguments from
the user that set the following:
- URL of the WebLogic Server
- Password for the WebLogic Server
- Name of the connection pool as registered in the
weblogic.properties file
- Interval at which the connections should be tested
to see if they need to be refreshed
- A simple SQL statement, one that is guaranteed to succeed
under any circumstances so long as there is a working connection
to the DBMS. An example would be the SQL statement "select 1 from
dual" which is guaranteed to succeed for an Oracle DBMS if the
connection is viable.
Other variables that you must set in this class are:
- The unit of time to be used for checking the viability of the
pool. For example, if you set "units" to SEC and
"interval" to "60," the connection pool will be tested once a
minute. The appropriate values for "unit" are:
After all of the information is collected from the user, we
use it to create ParamSets for the event registration. Then we
register an interest in the internal WebLogic event WEBLOGIC.TIME.
The Action method for this registration is ActionRefreshPool,
which is documented in
weblogic.event.actions.ActionRefreshPool.
All Examples This Package