Intelligent Event Processor (IEP) User's Guide

Configuring the IEP Database to Use MySQL

By default, the IEP database is configured to use Java DB. Java DB is Sun's supported distribution of the open source Apache Derby database. After installation, you can configure the IEP database to use MySQL instead.

The first task is to create an IEP user in the MySQL database and install the MySQL driver. You also need to create two sets of connection pools and JDBC resources. A connection pool is a group of reusable connections for a particular database. The server maintains a pool of available connections to increase performance. A JDBC resource provides applications with a means of connecting to a database. Additional configuration of the service engine is also required.

To configure the IEP Service Engine to use MySQL, perform the following steps:

ProcedureTo Create the IEP User in the MySQL Database

  1. Connect to the MySQL database as a user as root.

  2. Run the following statements against the database:


    create user username@hostname identified by 'password';
    create database database-name;
    grant all on database-name.* to username@hostname;

    Note –

    In the default Java DB database, the database schema name, username, and password are all IEPSEDB. You do not need to use these values.


ProcedureTo Install the MySQL Database Driver in the Application Server

  1. Go to the computer where the application server is installed.

  2. Copy and paste the MySQL database driver (mysql-connector-java-5.1.6-bin.jar) to the glassfish-home/lib directory.

  3. Restart the application server.

ProcedureTo Create the Non-XA Connection Pool

  1. Log in to the GlassFish Admin Console.

  2. In the left navigation panel, expand Resources and JDBC, and then select Connection Pools.

  3. Click New.

    The New JDBC Connection Pool page appears.

  4. Do the following:

    1. In the Name field, specify a name for the non-XA connection pool (for example, iepseMySqlPoolNonXA).

    2. In the Resource Type field, select javax.sql.DataSource or javax.sql.ConnectionPoolDataSource.

    3. In the Database Vendor field, select MySQL.

    4. Click Next.

  5. Scroll down to the Additional Properties table, and enter the following values:

    • port – The port number for the database. By default, MySQL uses 3306.

    • databaseName – The name of the database schema.

    • serverName – The name of the server on which the database is located.

    • user – The login ID of the IEP user (for example, IEPSEDB).

    • password – The password of the IEP user (for example, IEPSEDB).

    • url – The string for connecting to the database (for example, jdbc:mysql://myserver:3306/IEPSEDB).

  6. Click Finish.

    The connection pool is created.

  7. Click the connection pool that you just created.

    The Edit Connection Pool page appears.

  8. Click Ping.

    The Admin Console attempts to connect to the database. If the connection does not succeed, check to see whether the database is running and verify the database connectivity properties, such as the URL string.

ProcedureTo Create the Non-XA JDBC Resource

  1. In the left navigation panel of the Admin Console, expand Resources and JDBC, and then select JDBC Resources.

  2. Click New.

    The New JDBC Resource page appears.

  3. In the JNDI Name field, specify a unique name for the non-XA JDBC resource. By convention, the name begins with the jdbc/ string. For example:

    jdbc/iepseMySqlNonXA

    You will use the JNDI name in a later procedure.

  4. In the Pool Name field, select the non-XA connection pool that you created in the previous procedure.

  5. Click OK.

    The JDBC resource is created.

ProcedureTo Create the XA Connection Pool

  1. In the left navigation panel of the Admin Console, expand Resources and JDBC, and then select Connection Pools.

  2. Click New.

    The New JDBC Connection Pool page appears.

  3. Do the following:

    1. In the Name field, specify a name for the XA connection pool (for example, iepseMuyMySqlPoolXA).

    2. In the Resource Type field, select javax.sql.XADataSource.

    3. In the Database Vendor field, select MySQL.

    4. Click Next.

  4. Scroll down to the Connection Validation section, and select the Enabled check box that appears to the right of the Allow Non Component Callers label.

  5. Scroll down to the Additional Properties table, and enter the following values:

    • port – The port number for the database. By default, MySQL uses 3306.

    • databaseName – The name of the database schema.

    • serverName – The name of the server on which the database is located.

    • user – The login ID of the IEP user (for example, IEPSEDB).

    • password – The password of the IEP user (for example, IEPSEDB).

    • url – The string for connecting to the database (for example, jdbc:mysql://myserver:3306/IEPSEDB).

  6. Click Finish.

    The connection pool is created.

  7. Click the connection pool that you just created.

    The Edit Connection Pool page appears.

  8. Click Ping.

    The Admin Console attempts to connect to the database. If the connection does not succeed, check to see whether the database is running, and verify the connectivity parameters, such as the URL string.

ProcedureTo Create the XA JDBC Resource

  1. In the left navigation panel of the Admin Console, expand Resources and JDBC, and then select JDBC Resources.

  2. Click New.

    The New JDBC Resource page appears.

  3. In the JNDI Name field, specify a unique name for the XA JDBC resource. By convention, the name begins with the jdbc/ string. For example:

    jdbc/iepseMySqlXA

    You use the JNDI name in a later procedure.

  4. In the Pool Name drop-down menu, select the XA connection pool that you created.

  5. Click OK.

    The JDBC resource is created.

ProcedureTo Enable Automatic Recovery of XA Transactions

  1. In the left navigation panel of the Admin Console, expand Configuration and then select Transaction Service.

  2. Select the Enabled check box that appears to the right of the On Restart label.

  3. Click Save.

ProcedureTo Configure the IEP Service Engine to Use the JDBC Resources

  1. Log in to the NetBeans IDE.

  2. In the Services window, expand Servers > GlassFish V2 > JBI > Service Engines.

  3. If the IEP Service Engine is not started, right-click sun-iep-engine and select Start.

  4. Right-click sun-iep-engine and select Properties.

    The Properties dialog box appears.

  5. In the Non XA Data Source Name property, enter the non-XA JDBC resource that you created (for example, jdbc/iepseMySqlNonXA).

  6. In the XA Data Source Name property, enter the XA JDBC resource that you created (for example, jdbc/iepseMySQLXA).

  7. In the Database Schema Name property, enter the name of the MySQL schema for the IEP database.

  8. Click OK.

ProcedureTo Restart the IEP Service Engine and Create the Database Tables

When you restart the IEP Service Engine, the database tables are automatically created in the database you specified through the connection pools and runtime properties.

  1. If any Composite Application projects that contain event processes are currently deployed, undeploy the projects.

  2. In the Services window, expand Servers > GlassFish V2 > JBI > Service Engines.

  3. Right-click sun-iep-engine and select Stop.

  4. Right-click sun-iep-engine and select Start.

  5. If you undeployed any Composite Application projects, you can now redeploy the projects.