O'Reilly logo

Java Servlet & JSP Cookbook by Bruce W. Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

21.4. Creating a DataSource on WebLogic

Problem

You want to create a javax.sql.DataSource on BEA WebLogic for use in your servlets.

Solution

Use the WebLogic console to configure a new connection pool, then configure a new DataSource associated with that pool.

Discussion

Configuring a WebLogic DataSource involves the following steps:

  1. Login to the WebLogic console, which allows you to manage the WebLogic server from a browser. The URL for the console is typically http://<localhost:7001>/console (substitute your host name for "localhost" and the port number that matches your own WebLogic configuration).

  2. Click on Your-domain-name Services JDBC Connnection Pools on the menu tree in the console's lefthand column. Then click on "Configure a new JDBC Connection Pool . . . ".

  3. In the resulting window, enter a name for the connection pool, the JDBC URL (e.g., jdbc:oracle:thin:@192.168.0.2:1521:ORCL), the Driver class name (e.g., oracle.jdbc.driver.OracleDriver), as well as the username and password in the "Properties" text field. Figure 21-2 shows a configured connection pool named "OraclePool." Remember this name—you'll need it to configure a DataSource further along in the process.

Creating a connection pool with the WebLogic console application

Figure 21-2. Creating a connection pool with the WebLogic console application

  1. Click on the "Create" button in this window to create the connection pool, then choose the "Targets" tab. The resulting screen allows ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required