Skip Headers
Oracle® Fusion Middleware Database Administration Guide for Oracle WebLogic Portal
10g Release 3 (10.3.5)

Part Number E14233-03
Go to Documentation Home
Home
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

6 Using MySQL

This chapter describes the steps necessary to use a MySQL 5.0 database with WebLogic Portal, and includes the following sections:

Review this entire chapter and any release notes before proceeding. The tasks described in this chapter should be performed by a database administrator.

6.1 Configuring MySQL Databases

Before proceeding, read Section 2.1, "Overview of Enterprise-Quality Database Configuration for WebLogic Portal."

Caution:

The MySQL JDBC driver is not fully XA compatible, therefore WebLogic Portal does not support using the com.mysql.jdbc.jdbc2.optional.MysqlXADataSource. Data sources that require XA and those that are XA capable should use the com.mysql.jdbc.Driver with the global-transactions-protocol LoggingLastResource instead.

The database creation scripts install domain-specific tables. You should work with a database administrator to modify the sample scripts, and to create the database users and tablespaces needed for your environment.

Multiple database users are required if you have multiple domains, or to run multiple environments using the same MySQL instance (for example, if you want to run development and system test from a single MySQL installation). Any additional content management repositories require a separate database user.

To configure a MySQL database:

  1. Back up your database environment before installing any new database objects. See your database documentation for details.

  2. Review the provided sample scripts, located in the <WLPORTAL_HOME>/portal/db/mysql/admin directory. See Section 6.4, "Database Scripts and Usage Notes" and the comments in the scripts for additional information.

  3. Copy and modify the sample scripts appropriately for your environment to create each of the following database schemas:

    1. Follow the steps in Section 6.2, "Configuring the Main WebLogic Portal Database" to create the main WebLogic Portal user and database objects.

    2. If you want to create a separate behavior tracking database, follow the steps in Section 6.3, "Manually Creating a Separate Database and Database Objects for Behavior Tracking."

6.2 Configuring the Main WebLogic Portal Database

Perform the following steps to configure the main WebLogic Portal database:

  1. Copy the create_database.sql script and modify it appropriately for your environment. See Section 6.4, "Database Scripts and Usage Notes" and the comments in the script for additional information. For more information on character sets, see Section 3.2.3, "Choosing Character Sets and Sort Orders."

  2. Run the modified create_database.sql script as a user with user account creation privileges (normally the root user). For example, from mysql:

    mysql -uroot --password=password <create_database.sql 
    

Follow the remaining steps only if you want to create database objects manually rather than using the Configuration Wizard. To perform the remaining steps using the Configuration Wizard, see Oracle Fusion Middleware Creating Domains Using the Configuration Wizard.

  1. Open your domain's database.properties file for edit.

  2. Set database=mysql.

  3. Update the following settings (by replacing the @ symbols and the text between the symbols with the correct values) for your main WebLogic Portal database:

    mysql.user=@DB_USER@
    mysql.password=@DB_PASSWORD@
    mysql.url=jdbc:bea:mysql://@DB_HOST@:@DB_PORT@;SID=@DB_NAME@
    
  4. Create the database objects.

    1. Navigate to the <MW_HOME>\user_projects\domains\myPortalDomain directory.

    2. Enter one of the commands:

      • On Windows, double-click create_db.cmd.

      • On UNIX, run create_db.sh.

        If any error messages are displayed, check the create_db.log file for additional information.

        Note:

        After running create_db script, you need to update the database administrator password. See Section 3.8, "Note About Creating or Refreshing Database Objects" for detailed information.

  5. Replace the JDBC data sources in your domain, which point to Derby by default, with data sources that point to MySQL. You can configure them using the WebLogic Server Administration Console or choose from the samples provided and update them for your database environment. Sample jdbc.xml definition files for MySQL are available in the <WLPORTAL_HOME>\portal\db\jdbc\mysql directory. Follow the instructions in the <WLPORTAL_HOME>\portal\db\jdbc\README.txt file.

    Note:

    Do this while WebLogic Server is stopped.

6.3 Manually Creating a Separate Database and Database Objects for Behavior Tracking

For improved performance, you might want to store behavior tracking events in a different location from other WebLogic Portal database objects. For more information about behavior tracking, see "Setting Up Events and Behavior Tracking" in the Oracle Fusion Middleware Interaction Management Guide for Oracle WebLogic Portal.

Note:

By default, behavior tracking database objects are created in the same database as other WebLogic Portal database objects. You need to perform these steps only if you are configuring a separate database for behavior tracking events.

To create a separate database for behavior tracking:

  1. Modify the bt_create_database.sql file for your environment, as indicated in the instructions contained in the scripts and in Section 6.4, "Database Scripts and Usage Notes."

  2. Run bt_create_database.sql as a user with system administrator privileges. For example, from osql:

    mysql -uroot --password=password <bt_create_database.sql
    
  3. Navigate to the appropriate database directory based on your environment: <WLPORTAL_HOME>\portal\db\mysql

  4. Connect as the user WEBLOGIC_EVENT and run the following scripts:

    • bt_create_tables.sql

    • bt_create_fkeys.sql

    • bt_create_indexes.sql

    • bt_create_triggers.sql

  5. Run the following scripts from the path <WLPORTAL_HOME>\portal\db\data\required:

    • bt_insert_system_data.sql

    • bt9_insert_system_data.sql

  6. Use the WebLogic Server Administration Console to configure a non-XA JDBC data source to access your behavior tracking database. Associate the JNDI name p13n.trackingDataSource with that data source and then remove p13n.trackingDataSource from p13nDataSource.

6.4 Database Scripts and Usage Notes

Table 6-1 describes the scripts that enable you to configure the MySQL database and create WebLogic Portal objects in that database.

Table 6-1 Database Scripts and Usage Notes

Script Name Description
create_database.sql

Creates a database. You must create a main WebLogic Portal database.

Make a copy of this script and edit it to replace <<WEBLOGIC>> with the appropriate database name, database owner user, and password for each database you create.

Typical names for the main WebLogic Portal database are:

  • Database name: WEBLOGIC

  • Database owner user: WEBLOGIC

  • Password: WEBLOGIC

When you run the script with these values, it creates the WEBLOGIC database and the WEBLOGIC database owner user, and grants privileges to the WEBLOGIC user in order to create database objects.

Note: If you decide to create an additional content management repository, you must create a database with different user names for it. For additional information, see the Oracle Fusion Middleware Content Management Guide for Oracle WebLogic Portal.

bt_create_database.sql

Creates the WEBLOGIC_EVENT database and WEBLOGIC_EVENT database owner user login, and grants the privileges to the WEBLOGIC_EVENT user necessary for creating database objects.

Following are the default names:

  • Database name: WEBLOGIC_EVENT

  • Database owner user: WEBLOGIC_EVENT

  • Password: WEBLOGIC_EVENT