WebLogic Server 6.0.0 Code Examples, BEA Systems, Inc.

Package examples.jdbc.pool

This example shows how to use a WebLogic pool driver to make a JDBC connection for use in an HTTP servlet.

See:
          Description

JDBC Pool Examples Summary
simpleselect This example shows how to use a WebLogic pool driver to make a JDBC connection for a servlet.
 

Package jdbc.pool Description

This example shows how to use a WebLogic pool driver to make a JDBC connection for use in an HTTP servlet. This server-side JDBC pool can use a few JDBC connections that are created when the WebLogic Server starts up to serve many clients displaying database data in an HTTP servlet. (The WebLogic Tour uses a single-user version of a Cloudscape database with a server-side connection pool.)

The method uses the pool driver for database access and jsp to generate an HTML page for display.

You'll need a database with the "emp" table in it, like the DEMO database that comes with an Oracle installation. If you want to create the table yourself, you can create the DEMO database using the ddl at /samples/examples/utils/ddl/demo.ddl and the schema utility. For information on the schema utility see Using WebLogic Utilites.

You can use the Administration Console as well as the command line to build, compile, and run this example.

Build the Example

  1. Open a new command shell.

  2. Set up your development shell as described in Setting up Your Environment for Building and Running the Examples.

  3. Compile and copy the example simpleselect.jsp by executing the following commands or by executing the build script provided for this example in the samples/examples/jdbc/pool directory. The script will perform the following step:

    1. Compile the simpleselect class as shown in this example for Windows NT/2000:

      $ java weblogic.jspc -d %EX_WEBAPP_CLASSES% simpleselect.jsp

    2. Copy the simpleselect.jsp file located in the samples/examples/jdbc/pool directory in your WebLogic Server installation to the config/examples/applications/examplesWebApp directory in your WebLogic Server installation. This directory is the location of the publically available files of the examplesWebApp.

      $ copy simpleselect.jsp %APPLICATIONS%\examplesWebApp

  4. Start WebLogic Server.

Configure the Example

  1. Open the Administration Console.

  2. Verify that the Examples Web Application has been deployed on your server.

  3. Verify that the connection pool is enabled as follows:

Run the Example

  1. Use a Web browser to load the following:

    http://WebLogicHost:port/examplesWebApp/simpleselect.jsp

    Where WebLogicHost:port is the hostname and port number of your WebLogic Server.

There's more

For more information, see:


Documentation is available at
http://e-docs.bea.com/wls/docs60/

Copyright © 2000 BEA Systems, Inc. All rights reserved.