Chapter 8 Creating J2EE Applications for BEA WebLogic


Setting Up JDBC DataSource Factories

Follow these steps to bind a javax.sql.DataSource resource factory to a JNDI name in WebLogic Server. Note that you can set up either a transactional or non-transactional JDBC data source as necessary:

  1. Set up a JDBC connection pool in the Administration Console. See Managing JDBC Connectivity in the Administration Guide for more information.
  2. Start the WebLogic Server.
  3. Start the WebLogic Server Administration Console.
  4. In the Console, click the Services node and expand JDBC.
  5. Select Data Sources and choose the Create a new Data Source option.
  6. For non-transactional JDBC datasources, enter:

weblogic.jdbc.DataSource.jndi_name=pool_name

where jndi_name is the full WebLogic Server JNDI name to bind to the data source and pool_name is the name of the WebLogic Server connection pool you created in step 1.

For example, to set up a non-transactional connection pool for demonstration purposes, you might enter:

weblogic.jdbc.DataSource.weblogic.jdbc.demoPool=demoPool

This binds a transactional data source for the "demoPool" pool to the JNDI name, "weblogic.jdbc.demoPool".

For transactional JDBC datasources, enter:

weblogic.jdbc.TXDataSource.jndi_name=pool_name

where jndi_name is the full WebLogic Server JNDI name to bind to the transactional data source and pool_name is the name of the WebLogic Server connection pool you created in step 1.

For example, to set up a non-transactional connection pool for demonstration purposes, you might enter:

weblogic.jdbc.TXDataSource.weblogic.jdbc.jts.demoPool=demoPool

This binds a transactional data source for the "demoPool" pool to the JNDI name, "weblogic.jdbc.jts.demoPool".

  1. Click Create to save the changes.
  2. Bind the JNDI name of the data source to the EJB's local JNDI environment. To do this:

    Map an existing EJB resource factory reference to the JNDI name, or

    Directly edit the resource-description tag in the weblogic.ejb-jar.xml deployment file using a text editor

 


Copyright (C) 2005. Sybase Inc. All rights reserved.