} }

Oracle WebLogic Server ships with the PointBase database management system so that you can run code examples with a functional database server. The samples installed also include scripts to recreate the "demo" database in PointBase or create it in Oracle or another database management system (DBMS). See the following sections for more information:

PointBase Server is for demonstration (that is, non-production) use only. For more information about PointBase, see Using PointBase with Oracle WebLogic Server.

Setting Up Examples to Run with a PointBase Database

The examples installed with Oracle WebLogic Server include the PointBase "demo" database. The wl_server examples domain includes JDBC data sources configured to use the demo database out-of-the-box. You do not need to configure the database or database connectivity when running the examples in the wl_server domain. PointBase documentation is located in the WL_HOME/common/eval/pointbase/../../docs/ directory of your installation. The information in the following sections can help you configure database connectivity if you want to run the examples from a different domain or if you want to recreate the data in the database.

 

Prerequisites

Make sure that the PointBase server is running and that you have the following information:

The PointBase server starts automatically when the examplesServer in the wl_server domain is started. To make sure that the PointBase server is running, you can open the PointBase Console. See Opening the PointBase Console. If you are running examples in a different domain, you can manually start the PointBase server. See Starting PointBase Server.

 

Generating PointBase Data

Follow these steps to configure Oracle WebLogic Server example property values and populate the PointBase database with sample data:

  1. Using a text editor, open the examples.properties file, located in WL_HOME\samples\server\examples\src.
  2. Change the following lines to fit your environment: Save the file when you are finished.
  3. Open a command shell and set up the environment.
  4. Change to the WL_HOME\samples\server\examples\src\examples\common\ddl directory.
  5. Enter the following command:

    ant db.setup.pointbase

    This Ant target creates the tables and inserts sample data.

    To use a database server other than PointBase, Oracle, or MySQL, create a db.setup.db_vendor target in the build.xml file, similar to db.setup.pointbase, and set the driver class; URL; and host, username, and password for the server.

 

Configuring JDBC Data Sources for PointBase

Some Oracle WebLogic Server examples use database connections from JDBC data sources configured in the wl_server domain installed with the Oracle WebLogic Server examples. If you want to run an example in a different domain, you may need add one or more of the data sources to your WebLogic domain.

 

To configure the examples-demo data source:

  1. Open the Oracle WebLogic Server Administration Console.
  2. In the Domain Structure view in the left pane, expand Services > JDBC and select Data Sources.
  3. On the Summary of JDBC Data Sources page, click New.
  4. On the JDBC Data Source Properties page, enter or select the following information:

    Name of - Enter examples-demo.

    JNDI Name - Enter examples-dataSource-demoPool.

    Database Type - Select PointBase or the DBMS of the database to which you want to connect. If your DBMS is not listed, select Other.

    Database Driver - Select PointBase's Driver (Type 4) Versions:4.X,5.X or another non-XA JDBC driver that you want to use to connect to the database.

    Note: You must install JDBC drivers before you can use them to create database connections. Some JDBC drivers are installed with Oracle WebLogic Server, but not all listed drivers are installed. The PointBase driver is installed with Oracle WebLogic Server.

    Click Next to continue.

  5. On the Transactions Options page, follow these steps:
    1. Select Supports Global Transactions.
    2. Select One-Phase Commit.

    Click Next to continue.

  6. On the Connection Properties page, enter values for the following properties:

    Database Name - Enter demo or the name of the database to which you want to connect.

    Host Name - Enter localhost or the DNS name or IP address of the server that hosts the database.

    Port - Enter 9092 for PointBase or enter the port on which the database server listens for connections requests.

    Database User Name - Enter examples for the "demo" database installed with the Oracle WebLogic Server examples or if you are using a different database, enter the database user account name that you want to use for each connection in the data source.

    Password/Confirm Password - Enter examples for the "demo" database or enter the password for the database user acccount specified above.

    Click Next to continue.

  7. On the Test Database Connection page, review the connection parameters and click Test Configuration.

    Oracle WebLogic Server attempts to create a connection from the Administration Server to the database. Results from the connection test are displayed at the top of the page. If the test is unsuccessful, you should correct any configuation errors and retry the test.

    If the JDBC driver you selected is not installed on the Administration Server, you should click Next to skip this step.

    Click Next to continue.

  8. On the Select Targets page, select examplesServer or select the servers or clusters on which you want to deploy the data source.
  9. Click Finish to save the JDBC data source configuration. When your changes are activated, the data source will be deployed to the targets that you selected.
  10. To activate these changes, restart the server.

 

To configure the examples-demoXA data source:

  1. Open the Administration Console.
  2. In the Domain Structure view in the left pane, expand Services > JDBC and select Data Sources.
  3. On the Summary of Data Sources page, click New.
  4. On the JDBC Data Source Properties page, enter or select the following information:

    Name of - Enter examples-demoXA.

    JNDI Name - Enter examples-dataSource-demoXAPool.

    Database Type - Select PointBase or the DBMS of the database to which you want to connect. If your DBMS is not listed, select Other.

    Database Driver - Select PointBase's Driver (Type 4 XA) Versions:4.X,5.X or another XA JDBC driver that you want to use to connect to the database.

    Note: You must install JDBC drivers before you can use them to create database connections. Some JDBC drivers are installed with Oracle WebLogic Server, but not all listed drivers are installed. The PointBase driver is installed with Oracle WebLogic Server.

    Click Next to continue.

  5. On the Transactions Options page, disable Supports Global Transactions. If the XA JDBC driver you selected requires a global transaction to execute SQL code, skip this step. Click Next to continue.
  6. On the Connection Properties page, enter values for the following properties:

    Database Name - Enter demo or the name of the database to which you want to connect.

    Host Name - Enter localhost or the DNS name or IP address of the server that hosts the database.

    Port - Enter 9092 for PointBase or enter the port on which the database server listens for connections requests.

    Database User Name - Enter examples for the "demo" database installed with the Oracle WebLogic Server examples or if you are using a different database, enter the database user account name that you want to use for each connection in the data source.

    Password/Confirm Password - Enter examples for the "demo" database or enter the password for the database user acccount specified above.

    Click Next to continue.

  7. On the Test Database Connection page, review the connection parameters and click Test Configuration.

    Oracle WebLogic Server attempts to create a connection from the Administration Server to the database. Results from the connection test are displayed at the top of the page. If the test is unsuccessful, you should correct any configuation errors and retry the test.

    If the JDBC driver you selected is not installed on the Administration Server, you should click Next to skip this step.

    Click Next to continue.

  8. On the Select Targets page, select examplesServer or select the servers or clusters on which you want to deploy the data source.
  9. Click Finish to save the JDBC data source configuration. When your changes are activated, the data source will be deployed to the targets that you selected.
  10. To activate these changes, restart the server.

 

To configure the examples-demoXA-2 data source:

  1. Open the Administration Console.
  2. In the Domain Structure view in the left pane, expand Services > JDBC and select Data Sources.
  3. On the Summary of Data Sources page, click New.
  4. On the JDBC Data Source Properties page, enter or select the following information:

    Name of - Enter examples-demoXA-2.

    JNDI Name - Enter examples-demoXA-2.

    Database Type - Select PointBase or the DBMS of the database to which you want to connect. If your DBMS is not listed, select Other.

    Database Driver - Select PointBase's Driver (Type 4 XA) Versions:4.X,5.X or another XA JDBC driver that you want to use to connect to the database.

    Note: You must install JDBC drivers before you can use them to create database connections. Some JDBC drivers are installed with Oracle WebLogic Server, but not all listed drivers are installed. The PointBase driver is installed with Oracle WebLogic Server.

    Click Next to continue.

  5. On the Transactions Options page, disable Supports Global Transactions. If the XA JDBC driver you selected requires a global transaction to execute SQL code, skip this step. Click Next to continue.
  6. On the Connection Properties page, enter values for the following properties:

    Database Name - Enter demo or the name of the database to which you want to connect.

    Host Name - Enter localhost or the DNS name or IP address of the server that hosts the database.

    Port - Enter 9092 for PointBase or enter the port on which the database server listens for connections requests.

    Database User Name - Enter examples for the "demo" database installed with the Oracle WebLogic Server examples or if you are using a different database, enter the database user account name that you want to use for each connection in the data source.

    Password/Confirm Password - Enter examples for the "demo" database or enter the password for the database user acccount specified above.

    Click Next to continue.

  7. On the Test Database Connection page, review the connection parameters and click Test Configuration.

    Oracle WebLogic Server attempts to create a connection from the Administration Server to the database. Results from the connection test are displayed at the top of the page. If the test is unsuccessful, you should correct any configuation errors and retry the test.

    If the JDBC driver you selected is not installed on the Administration Server, you should click Next to skip this step.

    Click Next to continue.

  8. On the Select Targets page, select examplesServer or select the servers or clusters on which you want to deploy the data source.
  9. Click Finish to save the JDBC data source configuration. When your changes are activated, the data source will be deployed to the targets that you selected.
  10. To activate these changes, restart the server.

back to top

Setting Up Examples to Run with an Oracle Database

If you prefer to run samples using an Oracle DBMS, you can create the appropriate data in your Oracle database and configure the wl_server domain to connect to your Oracle database.

 

Prerequisites

Before you begin, ensure that you have access to an Oracle database with a user account with the appropriate privileges for creating and dropping tables and inserting records. Make sure that the database server is running and that you have the following information:

This information is available in the tnsnames.ora file, which typically resides in $ORACLE_HOME/network/admin on unix.os platforms and ORACLE_HOME\network\admin on Windows platforms. Additional information about your Oracle setup can be found in the listner.ora file, which resides in the same directory. See http://docs.oracle.com/.

The listed property values are used to connect to the database server when updating the database with tables and data required by Oracle WebLogic Server to run the sample applications.

 

Generating Oracle Data

Follow these steps to configure Oracle WebLogic Server example property values and populate the Oracle Database with sample data:

  1. Using a text editor, open the examples.properties file, located in WL_HOME\samples\server\examples\src.
  2. Change the following lines to fit your environment:
  3. Open a command shell and set up the environment.
  4. Change to the WL_HOME\samples\server\examples\src\examples\common\ddl directory.
  5. Enter the following command:

    ant db.setup.oracle

    This Ant target creates tables and inserts sample data.

To use a database server other than PointBase, Oracle, or MySQL, create a db.setup.db_vendor target in the build.xml file, similar to db.setup.pointbase, and set the driver class, url, and host, user, and password for the server.

 

Configuring JDBC Data Sources for Oracle

To use an Oracle database with the Oracle WebLogic Server examples, after configuring the database, configure JDBC data sources in the wl_server domain or the domain in which you want to run the examples. Follow the steps in the following sections to configure data sources used in sample applications. These instructions assume that you are modifying the existing data sources in the wl_server domain or that you created following instructions in Configuring JDBC Data Sources for PointBase.

 

To configure the examples-demo data source for Oracle

  1. Open the Administration Console.
  2. In the Domain Structure view in the left pane, expand Services > JDBC and select Data Sources.
  3. On the Summary of Data Sources page, click examples-demo.
  4. Select the Configuration > Connection Pool tab and enter or select the following information:

    URL - Enter the database URL in the following format: jdbc:bea:oracle://db_server:port

    Driver Class Name - Enter weblogic.jdbc.oracle.OracleDriver

    Properties - Enter the following properties, and replace the values with values for your environment:
    user=dbuser
    portNumber=1521
    SID=db_service_name
    serverName=db_server

    Password/Confirm Password - Enter the password for the database user account specified in the properties list.

    Note: You must install JDBC drivers before you can use them to create database connections. Some JDBC drivers are installed with Oracle WebLogic Server, but not all listed drivers are installed. The WebLogic Type 4 Driver for Oracle driver is installed with Oracle WebLogic Server.

  5. Click Save.
  6. Click Advanced at the bottom of the page.
  7. In Test Table Name, enter dual, then click Save.
  8. To activate these changes, restart the server.

 

To configure the examples-demoXA data source for Oracle:

  1. Open the Administration Console.
  2. In the Domain Structure view in the left pane, expand Services > JDBC and select Data Sources.
  3. On the Summary of Data Sources page, click examples-demoXA.
  4. Select the Configuration > Connection Pool tab and enter or select the following information:

    URL - Enter the database URL in the following format: jdbc:bea:oracle://db_server:port

    Driver Class Name - Enter weblogic.jdbcx.oracle.OracleDataSource

    Properties - Enter the following properties, and replace the values with values for your environment:
    user=dbuser
    portNumber=1521
    SID=db_service_name
    serverName=db_server

    Password/Confirm Password - Enter the password for the database user account specified in the properties list.

    Note: You must install JDBC drivers before you can use them to create database connections. Some JDBC drivers are installed with Oracle WebLogic Server, but not all listed drivers are installed. The WebLogic Type 4 XA Driver for Oracle driver is installed with Oracle WebLogic Server.

  5. Click Save.
  6. Click Advanced at the bottom of the page.
  7. In Test Table Name, enter dual, then click Save.
  8. To activate these changes, restart the server.

 

To configure the examples-demoXA-2 data source for Oracle:

  1. Open the Administration Console.
  2. In the Domain Structure view in the left pane, expand Services > JDBC and select Data Sources.
  3. On the Summary of Data Sources page, click examples-demoXA-2.
  4. Select the Configuration > Connection Pool tab and enter or select the following information:

    URL - Enter the database URL in the following format: jdbc:bea:oracle://db_server:port

    Driver Class Name - Enter weblogic.jdbcx.oracle.OracleDataSource

    Properties - Enter the following properties, and replace the values with values for your environment:
    user=dbuser
    portNumber=1521
    SID=db_service_name
    serverName=db_server

    Password/Confirm Password - Enter the password for the database user account specified in the properties list.

    Note: You must install JDBC drivers before you can use them to create database connections. Some JDBC drivers are installed with Oracle WebLogic Server, but not all listed drivers are installed. The WebLogic Type 4 XA Driver for Oracle driver is installed with Oracle WebLogic Server.

  5. Click Save.
  6. Click Advanced at the bottom of the page.
  7. In Test Table Name, enter dual, then click Save.
  8. To activate these changes, restart the server.

 

To configure the examples-oracleXA data source:

Some code examples that demonstrate Oracle advanced features may require an additional data source that uses the Oracle Thin driver. The examples-oracleXA is configured in the wl_server domain, but must be modified to fit your environment.

  1. Open the Administration Console.
  2. In the Domain Structure view in the left pane, expand Services > JDBC and select Data Sources.
  3. On the Summary of Data Sources page, click examples-oracleXA.
  4. Select the Configuration > Connection Pool tab and enter or select the following information:

    URL - Enter the database URL in the following format: jdbc:oracle:thin:@db_server:port:SID

    Driver Class Name - Enter oracle.jdbc.xa.client.OracleXADataSource

    Properties - Replace the user value with a database user name for your database:
    user=dbuser

    Password/Confirm Password - Enter the password for the database user account specified in the properties list.

    Note: You must install JDBC drivers before you can use them to create database connections. Some JDBC drivers are installed with Oracle WebLogic Server, but not all listed drivers are installed. The Oracle Thin driver is installed with Oracle WebLogic Server.

  5. Click Save.
  6. To activate these changes, restart the server.

back to top

Setting Up Examples to Run with a MySQL Database

If you prefer to run samples using an MySQL DBMS, you can create the appropriate data in your MySQL database and configure the wl_server domain to connect to your MySQL database.

 

Prerequisites

 

Generating MySQL Data

Follow these steps to configure Oracle WebLogic Server example property values and populate the MySQL Database with sample data:

  1. Using a text editor, open the examples.properties file, located in WL_HOME\samples\server\examples\src.
  2. Change the following lines to fit your environment:
  3. Open a command shell and set up the environment.
  4. Change to the WL_HOME\samples\server\examples\src\examples\common\ddl directory.
  5. Enter the following command:

    ant db.setup.mysql

    This Ant target creates tables and inserts sample data.

To use a database server other than PointBase, Oracle, or MySQL, create a db.setup.db_vendor target in the build.xml file, similar to db.setup.pointbase, and set the driver class, url, and host, user, and password for the server.

 

Configuring JDBC Data Sources for MySQL

To use a MySQL database with the Oracle WebLogic Server examples, after configuring the database, configure JDBC data sources in the wl_server domain or the domain in which you want to run the examples. Follow the steps in the following sections to configure data sources used in sample applications. These instructions assume that you are modifying the existing data sources in the wl_server domain or that you created following instructions in Configuring JDBC Data Sources for PointBase.

 

To configure the examples-demo data source for MySQL

  1. Open the Administration Console.
  2. In the Domain Structure view in the left pane, expand Services > JDBC and select Data Sources.
  3. On the Summary of Data Sources page, click examples-demo.
  4. Select the Configuration > Connection Pool tab and enter or select the following information:

    URL - Enter the database URL in in the jdbc:mysql://host_name:port/database_name format

    Driver Class Name - Enter com.mysql.jdbc.Driver

    Properties - Not needed if you use an anonymous account. Otherwise, set user=your user name.

    Password/Confirm Password - If needed, enter the password for the database user account specified in Properties.

    Note: You must install JDBC drivers before you can use them to create database connections. Some JDBC drivers are installed with Oracle WebLogic Server, but not all listed drivers are installed. The MySQL driver is not installed with Oracle WebLogic Server. See Using Third-Party JDBC Drivers with Oracle WebLogic Server.

  5. Click Save.
  6. Click Advanced at the bottom of the page.
  7. In Test Table Name, enter SQL SELECT 1, then click Save.
  8. To activate these changes, in the Change Center, click Activate Changes. You must also restart the server.

 

To configure the examples-demoXA data source for MySQL:

  1. Open the Administration Console.
  2. In the Change Center, click Lock & Edit.
  3. In the Domain Structure tree, expand Services > JDBC and select Data Sources.
  4. On the Summary of Data Sources page, click examples-demoXA.
  5. Select the Configuration > Connection Pool tab and enter or select the following information:

    URL - Enter the database URL in in the jdbc:mysql://host_name:port/database_name format

    Driver Class Name - Enter com.mysql.jdbc.Driver

    Properties - Not needed if you use an anonymous account. Otherwise, set user=your user name.

    Password/Confirm Password - If needed, enter the password for the database user account specified in Properties.

    Note: You must install JDBC drivers before you can use them to create database connections. Some JDBC drivers are installed with Oracle WebLogic Server, but not all listed drivers are installed. The MySQL driver is not installed with Oracle WebLogic Server. See Using Third-Party JDBC Drivers with Oracle WebLogic Server.

  6. Click Save.
  7. Click Advanced at the bottom of the page.
  8. In Test Table Name, enter SQL SELECT 1, then click Save.
  9. To activate these changes, restart the server.

 

 

back to top


Copyright © 1996, 2009, Oracle and/or its affiliates. All Rights Reserved.