|
WebLogic Server 7.0 Code Examples, BEA Systems, Inc. | |||||
See:
Description
| Class Summary | |
| Client | |
| DynamicConnectionPoolHelper | This class demonstrates dymamic creation, using and deletion of Connection Pools via Weblogic management API. |
This example illustrates how to dynamically create and delete a connection pool in an application using the WebLogic management API. It creates a JDBC connection pool named dynamicDemoPool. If the connection pool already exists (from previously running this example), the application deletes the existing connection pool and creates a new connection pool with the same name. The examples.jdbc.datasource.dynamic example uses the connection pool created in this example to demonstrate how to dynamically create a DataSource and then how to use it to get and close a database connection.
The example code in DynamicConnectionPoolHelper.java shows how to:
| Additional Resources for examples.jdbc.pool.dynamic | |
| build.xml | The Java Ant build script, which assembles and deploys required client applications for this example. |
NOTE: The examples.jdbc.datasource.dynamic example relies on the source files used in this example. If you modify the source files in this example, the examples.jdbc.datasource.dynamic example may not run.
The following sections describe how to build and run the example.
Before you run this example, you need:
NOTE: This example uses the demo database as shipped with WebLogic Server 7.0. It uses examples as the username and password to connect to the database. If you modify the database, you may need to change the username and password hard-coded in the build.xml file.
ant
Buildfile: build.xml
compile:
[echo] Compiling Dynamic Connection Pool Example
[javac] Compiling 2 source files to D:\bea\weblogic700\samples\server\stage\examples\clientclasses
all:
BUILD SUCCESSFUL
Total time: 3 seconds
ant run
You can modify run target in build.xml to fit your environment and server configuration.
When you run the example, you should see output in the command shell similar to the following:
D:\bea\weblogic700\samples\server\src\examples\jdbc\pool\dynamic>ant run
Buildfile: build.xml
run:
[java] Creating Connection Pool...
[java] Looping through all connection pools...
[java] oraclePool
[java] demoPool
[java] mssqlserverPool
[java] demoXAPool
[java] Creating Connection Pool: dynamicDemoPool
[java] Starting up connection pool.
BUILD SUCCESSFUL
Total time: 5 seconds
|
Documentation is available at http://e-docs.bea.com/wls/docs70 |
|||||