Skip Headers
Oracle® Fusion Middleware Administrator's Guide for Oracle Complex Event Processing
11g Release 1 (11.1.1.6.3)

Part Number E14300-10
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

13 Configuring JDBC for Oracle CEP

This chapter describes how to configure Java Database Connectivity (JDBC) for use with Oracle Complex Event Processing (Oracle CEP), including information on configuring data sources and on using Oracle and Type 4 Data Direct JDBC drivers.

13.1 Overview of Database Access from an Oracle CEP Application

Oracle CEP supports Java Database Connectivity (JDBC) 3.0 (see http://java.sun.com/products/jdbc/download.html#corespec30) for relational database access.

The JDBC API (see http://java.sun.com/javase/technologies/database/index.jsp) provides a standard, vendor-neutral mechanism for connecting to and interacting with database servers and other types of tabular resources that support the API. The JDBC javax.sql.DataSource interface specifies a database connection factory that is implemented by a driver. Instances of DataSource objects are used by applications to obtain database connections (instances of java.sql.Connection). After obtaining a connection, an application interacts with the resource by sending SQL commands and receiving results.

Oracle CEP provides the following JDBC drivers:

Optionally, you can use your own JDBC driver (see Section 13.5.3, "How to Access a Database Driver Using bootclasspath").

Oracle CEP also provides a DataSource abstraction that encapsulates a JDBC driver DataSource object and manages a pool of pre-established connections, and the Oracle WebLogic Server WLConnection interface provides useful methods for accessing and manipulating Oracle data sources. For more information, see Section 13.2, "Description of Oracle CEP Data Sources".

13.1.1 Oracle JDBC Driver

Oracle CEP includes the Oracle 11.2 Thin driver packaged in the following JAR files:

  • ORACLE_CEP_HOME/modules/com.bea.oracle.ojdbc5_1.0.0.0_11-2-0-0.jar: for use with Java SE 5.

  • ORACLE_CEP_HOME/modules/com.bea.oracle.ojdbc6_1.0.0.0_11-2-0-0.jar: for use with Java SE 6.

The JDBC Thin driver is a pure Java, Type IV driver that can be used in applications and applets. It is platform-independent and does not require any additional Oracle software on the client side. The JDBC Thin driver communicates with the server using SQL*Net to access the Oracle Database.

For more information, see:

13.1.2 Type 4 JDBC Driver for SQL Server from DataDirect

Oracle CEP provides a Type 4 JDBC driver from DataDirect for high-performance JDBC access to the SQL Server database. The Type 4 JDBC driver is optimized for the Java environment, allowing you to incorporate Java technology and extend the functionality and performance of your existing system.

The Oracle CEP Type 4 JDBC drivers from DataDirect are proven drivers that:

  • Support performance-oriented and enterprise functionality such as distributed transactions, savepoints, multiple open result sets and parameter metadata.

  • Are Java EE Compatibility Test Suite (CTS) certified and tested with the largest JDBC test suite in the industry.

  • Include tools for testing and debugging JDBC applications.

For more information, see:

13.1.3 Supported Databases

Oracle CEP server supports different databases depending on the type of JDBC driver you use:

13.1.3.1 Databases Supported by the Oracle JDBC Driver

Using the Oracle JDBC driver, you can access the following Oracle databases:

  • Oracle Database 11g release 2 (11.2)

For more information, see Section 13.1.1, "Oracle JDBC Driver".

13.1.3.2 Databases Supported by the Type 4 JDBC Driver for SQL Server from DataDirect

Using the SQL Server Type 4 JDBC Driver from DataDirect, you can access the following SQL Server databases:

  • Microsoft SQL Server 2005

  • Microsoft SQL Server 2000

  • Microsoft SQL Server 2000 Desktop Engine (MSDE 2000)

  • Microsoft SQL Server 2000 Enterprise Edition (64-bit)

  • Microsoft SQL Server 7.0

For more information, see Section 13.1.2, "Type 4 JDBC Driver for SQL Server from DataDirect".

13.2 Description of Oracle CEP Data Sources

Oracle CEP DataSource provides a JDBC data source connection pooling implementation that supports the Java Database Connectivity (JDBC 3.0) specification. Applications reserve and release Connection objects from a data source using the standard DataSource.getConnection and Connection.close APIs respectively.

Figure 13-1 shows the relationship between data source, connection pool, and Connection instances.

Figure 13-1 Oracle CEP Data Source

Description of Figure 13-1 follows
Description of "Figure 13-1 Oracle CEP Data Source"

You must use the Oracle CEP server default data source or configure your own Oracle CEP DataSource in the server's config.xml file if you want to access a relational database:

You do not have to configure a DataSource in the server's config.xml file if you use the JDBC driver's API, such as DriverManager, directly in your application code.

For more information, see:

13.2.1 Default Data Source Configuration

By default, the Oracle CEP server creates a local transaction manager. The transaction manager in turn depends on a configured RMI object, as described in Section 12.2.2, "rmi Configuration Object." Oracle CEP server guarantees that there will never be more than one transaction manager instance in the system.

If a database is unavailable at the time you start Oracle CEP server, by default, an Oracle CEP server data source retries every 10 seconds until it can create a connection. This allows the Oracle CEP server to successfully start up even if a database is unavailable. You can change the retry interval in the Oracle CEP server config.xml file using the connection-pool-params element connection-creation-retry-frequency-seconds child element. Setting this element to zero disables connection retry.

For more information, see Section 13.2.2, "Custom Data Source Configuration".

13.2.2 Custom Data Source Configuration

The Oracle CEP server config.xml file requires a configuration element for each data source that is to be created at runtime that references an external JDBC module descriptor.

This section describes how to configure a custom data source configuration. For more information on default data source configuration, see Section 13.2.1, "Default Data Source Configuration".

When you create an Oracle CEP domain using the Configuration Wizard, you can optionally configure a JDBC data source that uses one of the two DataDirect JDBC drivers; in this case the wizard updates the config.xml file for you. You configure the data source with basic information, such as the database you want to connect to and the connection username and password. You can also use the Configuration Wizard to update an existing server in a domain and add new data sources.

For more information, see:

You can also update the config.xml file manually by adding a data-source element as Example 13-1 shows.

Example 13-1 Custom Data Source Configuration in Oracle CEP Server config.xml

<data-source>
    <name>rdbms</name>
    <data-source-params>
        <global-transactions-protocol>None</global-transactions-protocol>
    </data-source-params>
    <connection-pool-params>
        <test-table-name>SQL SELECT 1 FROM DUAL</test-table-name>
        <initial-capacity>5</initial-capacity>
        <max-capacity>10</max-capacity>
        <connection-creation-retry-frequency-seconds>
            60
        </connection-creation-retry-frequency-seconds>
    </connection-pool-params>
    <driver-params>
        <url>jdbc:oracle:thin:@localhost:5521:rdb</url>
        <driver-name>oracle.jdbc.OracleDriver</driver-name>
        <properties>
            <element><name>user</name><value>scott</value></element>
            <element><name>password</name><value>tiger</value></element>
        </properties>
        <use-xa-data-source-interface>true</use-xa-data-source-interface>
    </driver-params>
</data-source>
<transaction-manager>
    <name>TM</name>
    <rmi-service-name>RMI</rmi-service-name>
</transaction-manager>

A data source depends on the availability of a local transaction manager. You can rely on the default Oracle CEP server transaction manager or configure one using the transaction-manager element of config.xml as Example 13-1 shows. The transaction manager in turn depends on a configured RMI object, as described in Section 12.2.2, "rmi Configuration Object."

If a database is unavailable at the time you start Oracle CEP server, by default, an Oracle CEP server data source retries every 10 seconds until it can create a connection. This allows the Oracle CEP server to successfully start up even if a database is unavailable. Example 13-1 shows how you can change the retry interval in the Oracle CEP server config.xml file using the connection-pool-params element connection-creation-retry-frequency-seconds child element. Setting this element to zero disables connection retry.

For the full list of child elements of the data-source element, in particular the connection-pool-params and data-source-params elements, see "Server Configuration XSD Schema: wlevs_server_config.xsd" in the Oracle Fusion Middleware Developer's Guide for Oracle Complex Event Processing for Eclipse.

For information on security configuration tasks that affect JDBC, see Section 10.8.3, "Configuring JDBC Security".

13.2.3 Getting the Native JDBC Connection

The Oracle Fusion Middleware Oracle WebLogic Server API Reference provides a WLConnection interface that contains useful methods for getting and manipulating Oracle data sources. For example, the following Java code gets the native Oracle database connection from the pooled connection object.

private DataSource ods;
private Connection wlConnection;
private OracleConnection connection;

wlConnection = ods.getConnection();
connection = (OracleConnection) ((WLConnection) wlConnection)
.getVendorConnection();

Note:

Be sure to close pooled connections when you are finished with them, and do not use a native connection object after the pooled connection has been closed.

13.3 Configuring Access to a Database Using the Oracle JDBC Driver

The Oracle JDBC driver is automatically installed with Oracle CEP and ready to use. For more information, see Section 13.1.1, "Oracle JDBC Driver".

To configure access to a database using the Oracle JDBC driver:

  1. Configure the data source in the server's config.xml file:

    1. To update the Oracle CEP server config.xml file using the Configuration Wizard, see "Creating and Updating Oracle CEP Standalone-Server Domains" in the Oracle Fusion Middleware Administrator's Guide for Oracle Complex Event Processing.

    2. To update the Oracle CEP server config.xml file manually, see Section 13.2.2, "Custom Data Source Configuration."

    Note:

    The url element for the Oracle JDBC driver is of the form:

    <url>jdbc:oracle:thin:@HOST:PORT:SID</url>
    
  2. If Oracle CEP is running, restart it so it reads the new data source information.

    For more information, see Section 1.5.4, "Starting and Stopping Oracle CEP Servers".

13.4 Configuring Access to a Database Using the Type 4 JDBC Drivers from Data Direct

The type 4 JDBC drivers from DataDirect for SQL Server are automatically installed with Oracle CEP and ready to use. For more information, see Section 13.1.2, "Type 4 JDBC Driver for SQL Server from DataDirect".

To configure access to a database using the Type 4 JDBC drivers from Data Direct:

  1. Configure the data source in the server's config.xml file:

    1. To update the Oracle CEP server config.xml file using the Configuration Wizard, see "Creating and Updating Oracle CEP Standalone-Server Domains" in the Oracle Fusion Middleware Administrator's Guide for Oracle Complex Event Processing.

    2. To update the Oracle CEP server config.xml file manually, see Section 13.2.2, "Custom Data Source Configuration."

    Note:

    The url element for the type 4 JDBC drivers from DataDirect is of the form:

    <url>jdbc:weblogic:sqlserver://HOST:PORT</url>
    
  2. If Oracle CEP is running, restart it so it reads the new data source information.

    For more information, see Section 1.5.4, "Starting and Stopping Oracle CEP Servers".

13.5 Configuring Access to a Different Database Driver or Driver Version

In some cases, you may need to use a different version of the Oracle Database driver or Data Direct drivers than the version bundled with Oracle CEP or you may need to use a database driver other than the Oracle Database driver or Data Direct drivers.

This section describes the following:

13.5.1 How to Access a Database Driver Using an Application Library Built With bundler.sh

This procedure describes how to create an OSGi bundle for your driver using the bundler utility and deploy it on the Oracle CEP server.

This is the preferred method. If wish to manually configure the activator implementation, see Section 13.5.2, "How to Access a Database Driver Using an Application Library Built With Oracle CEP IDE for Eclipse".

For more information, see "Creating Application Libraries" in the Oracle Fusion Middleware Developer's Guide for Oracle Complex Event Processing for Eclipse.

To access a database driver using an application library built with bundler.sh:

  1. Set up your environment as described in "Setting Your Development Environment" in the Oracle Fusion Middleware Getting Started Guide for Oracle Complex Event Processing.

  2. Execute the bundler.sh script to create an OSGi bundle containing your driver.

    The bundler.sh script is located in the ORACLE_CEP_HOME/ocep_11.1/bin directory, where ORACLE_CEP_HOME is the directory in which you installed the Oracle CEP server.

    Example 13-2 lists the bundler.sh command line options and Table 13-1 describes them.

    Example 13-2 bundler.sh Command Line Options

    bundler.sh
        -source <jar> 
        -name <name> 
        -version <version> 
        [-factory <class>+] 
        [-service <interface>+] 
        [-stagedir <path>] 
        [-targetdir <path>] 
    

    Table 13-1 bundler.sh Command Line Options

    Argument Description

    -source

    The path of the source JAR file to be bundled.

    -name

    The symbolic name of the bundle. The root of the target JAR file name is derived from the name value.

    -version

    The bundle version number. All exported packages are qualified with a version attribute with this value. The target JAR file name contains the version number.

    -factory

    An optional argument that specifies a space-delimited list of one or more factory classes that are to be instantiated and registered as OSGi services. Each service is registered with the OSGi service registry with name (-name) and version (-version) properties.

    -service

    An optional argument that specifies a space-delimited list of one or more Java interfaces that are used as the object class of each factory object service registration. If no interface names are specified, or the number of interfaces specified does not match the number of factory classes, then each factory object will be registered under the factory class name.

    -stagedir

    An optional argument that specifies where to write temporary files when creating the target JAR file.

    Default: ./bundler.tmp

    -targetdir

    An optional argument that specifies the location of the generated bundle JAR file.

    Default: current working directory (.).


    Example 13-3 shows how to use the bundler.sh to create an OSGi bundle for an Oracle JDBC driver.

    Example 13-3 Using the Bundler Utility

    bundler.sh \
        -source C:\drivers\com.oracle.ojdbc14_11.2.0.jar \
        -name oracle11g \
        -version 11.2.0 \
        -factory oracle.jdbc.xa.client.OracleXADataSource oracle.jdbc.OracleDriver \
        -service javax.sql.XADataSource java.sql.Driver \
        -targetdir C:\stage
    

    The source JAR is an Oracle driver located in directory C:\drivers. The name of the generated bundle JAR is the concatenation of the -name and -version arguments (oracle10g_11.2.0.jar) and is created in the C:\stage directory. The bundle JAR contains the files that Example 13-4 shows.

    Example 13-4 Bundle JAR Contents

    1465 Thu Jun 29 17:54:04 EDT 2006 META-INF/MANIFEST.MF
    1540457 Thu May 11 00:37:46 EDT 2006 com.oracle.ojdbc14_11.2.0.jar
       1700 Thu Jun 29 17:54:04 EDT 2006 com/bea/core/tools/bundler/Activator.class
    

    The command line options specify that there are two factory classes that will be instantiated and registered as an OSGi service when the bundle is activated, each under a separate object class as Table 13-2 shows.

    Table 13-2 Factory Class and Service Interface

    Factory Class Service Interface

    oracle.jdbc.xa.client.OracleXADataSource

    javax.sql.XADataSource

    oracle.jdbc.OracleDriver

    java.sql.Driver


    Each service registration will be made with a name property set to oracle11g and a version property with a value of 11.2.0. Example 13-5 shows the Oracle CEP server log messages showing the registration of the services.

    Example 13-5 Service Registration Log Messages

    ...
    INFO: [Jun 29, 2006 5:54:18 PM] Service REGISTERED: { version=11.2.0, name=oracle11g, objectClass=[ javax.sql.XADataSource ], service.id=23 }
    INFO: [Jun 29, 2006 5:54:18 PM] Service REGISTERED: { version=11.2.0, name=oracle11g, objectClass=[ java.sql.Driver ], service.id=24 }
    INFO: [Jun 29, 2006 5:54:18 PM] Bundle oracle11g STARTED
    ...
    
  3. Copy the bundler JAR to the Oracle CEP server library extensions directory.

    Because your Oracle CEP application is an application library which contains a driver, you copy it to the Oracle CEP server library extensions directory is the DOMAIN_DIR/servername/modules/ext directory, where DOMAIN_DIR refers to the domain directory such as /oracle_cep/user_projects/domains/mydomain and servername refers to the server instance, such as myserver. For example:

    c:\oracle_cep\user_projects\domains\mydomain\myserver\modules\ext
    

    For more information, see "Library Extensions Directory" in the Oracle Fusion Middleware Developer's Guide for Oracle Complex Event Processing for Eclipse.

  4. In the Oracle CEP server config.xml file, create a custom data-source element for your driver version and add a driver-params child element as Example 13-6 shows. For more information, see Section 1.3.1, "Oracle CEP Server Configuration Files".

    Example 13-6 driver-params Child Element

    <driver-params>
          <url>jdbc:oracle:thin:@lcw2k18:1531:lcw101</url>
          <driver-name>oracle.jdbc.xa.client.OracleXADataSource</driver-name
          <properties>
            <element>
              <name>user</name>
              <value>scott</value>
            </element>
            <element>
              <name>password</name>
              <value>{3DES}EoIfSBMhnW8=</value>
            </element>
            <element>
              <name>com.bea.core.datasource.serviceName</name>
              <value>oracle11g</value>
            </element>
            <element>
              <name>com.bea.core.datasource.serviceVersion</name>
              <value>11.2.0</value>
            </element>
            <element>
              <name>com.bea.core.datasource.serviceObjectClass</name>
              <value>javax.sql.XADataSource</value>
            </element>
          </properties>
          <use-xa-data-source-interface>true</use-xa-data-source-interface>
        </driver-params>
    

    Table 13-4 describes the relevant properties.

    Table 13-3 driver-params Child Element Properties

    Property Description

    com.bea.core.datasource.serviceName

    Specifies the value of the serviceName registration property.

    This must match the NAME property in your Activator class.

    com.bea.core.datasource.serviceVersion

    Specifies the value of the serviceVersion registration property.

    This must match the VERSION property in your Activator class.

    com.bea.core.datasource.serviceObjectClass

    Specifies the interface name of the OSGI service registration.


    For more information, see Section 13.2.2, "Custom Data Source Configuration".

  5. Stop and start the Oracle CEP server.

    For more information, see Section 1.5.4, "Starting and Stopping Oracle CEP Servers".

13.5.2 How to Access a Database Driver Using an Application Library Built With Oracle CEP IDE for Eclipse

This procedure describes how to create an OSGi bundle for your driver using the Oracle CEP IDE for Eclipse and deploy it on the Oracle CEP server.

This is the preferred method. If do not wish to manually configure the activator implementation, see Section 13.5.1, "How to Access a Database Driver Using an Application Library Built With bundler.sh".

For more information, see "Creating Application Libraries" in the Oracle Fusion Middleware Developer's Guide for Oracle Complex Event Processing for Eclipse.

To access a database driver using an application library built with Oracle CEP IDE for Eclipse:

  1. Using the Oracle CEP IDE for Eclipse, create a new Oracle CEP project.

    For more information, see "Creating Oracle CEP Projects" in the Oracle Fusion Middleware Developer's Guide for Oracle Complex Event Processing for Eclipse.

  2. Right-click your project folder and select New > Folder.

  3. Enter lib in the Folder name field and click Finish.

  4. Outside of the Oracle CEP IDE for Eclipse, copy your JDBC JAR file into the lib folder.

  5. Inside the Oracle CEP IDE for Eclipse, right-click the lib folder and select Refresh.

    The JAR file appears in the lib folder as Figure 13-2 shows.

    Figure 13-2 Oracle CEP IDE for Eclipse lib Directory

    Description of Figure 13-2 follows
    Description of "Figure 13-2 Oracle CEP IDE for Eclipse lib Directory"

  6. Right-click the src directory and select New > Class.

    The Java Class dialog appears as Figure 13-3 shows.

    Figure 13-3 New Java Class Dialog

    Description of Figure 13-3 follows
    Description of "Figure 13-3 New Java Class Dialog"

  7. Configure the New Java Class dialog as Table 13-4 shows.

    Table 13-4 New Java Class Parameters

    Parameter Description

    Package

    The package name. For example, com.foo.

    Name

    The name of the class. For example, MyActivator.


    Leave the other parameters at their default values.

  8. Click Finish.

    A new Java class is added to your project.

  9. Edit the Java class to implement it as Example 13-7 shows.

    Be sure to set the NAME and VERSION so that they supersede the existing version of JDBC driver. In this example, the existing version is:

    • oracle10g

    • 10.0.0

    To supersede the existing version, the MyActivator class sets these values to:

    • oracle11g

    • 11.2.0

    Example 13-7 MyActivator Class Implementation

    package com.foo;
     
    import java.util.Dictionary;
    import java.util.Properties;
     
    import javax.sql.XADataSource;
    import java.sql.Driver;
     
    import org.osgi.framework.BundleActivator;
    import org.osgi.framework.BundleContext;
    import org.osgi.framework.ServiceRegistration;
     
    public class MyActivator implements BundleActivator {
      
      private static final String NAME="oracle11g";
      private static final String VERSION="11.2.0";
      
      private String[] factories = {"oracle.jdbc.xa.client.OracleXADataSource","oracle.jdbc.OracleDriver"};
      private String[] interfaces= {"javax.sql.XADataSource","java.sql.Driver"};
      private ServiceRegistration[] serviceRegistrations = new ServiceRegistration[factories.length];
      
      public void start(BundleContext bc) throws Exception {
        Dictionary props = new Properties();
        props.put("name", NAME);
        props.put("version", VERSION);
        for (int i=0; i<factories.length; i++) {
          Object svc = bc.getBundle().loadClass(factories[i]).newInstance();
          serviceRegistrations[i] = bc.registerService(interfaces[i], svc, props);
        }
      }
     
      public void stop(BundleContext bc) throws Exception {
        for (int i=0; i<serviceRegistrations.length; i++) {
          serviceRegistrations[i].unregister();
        }
      }
    }
    
  10. Right-click the META-INF/MANIFEST.MF file and select Open With > Plug-in Manifest Editor.

    The Manifest Editor appears as Figure 13-4 shows.

    Figure 13-4 Manifest Editor: Overview Tab

    Description of Figure 13-4 follows
    Description of "Figure 13-4 Manifest Editor: Overview Tab"

  11. Click the Runtime tab.

    The Runtime tab appears as Figure 13-5 shows.

    Figure 13-5 Manifest Editor: Runtime Tab

    Description of Figure 13-5 follows
    Description of "Figure 13-5 Manifest Editor: Runtime Tab"

  12. In the Classpath pane, click Add.

    The JAR Selection dialog appears as Figure 13-6 shows.

    Figure 13-6 JAR Selection Dialog

    Description of Figure 13-6 follows
    Description of "Figure 13-6 JAR Selection Dialog"

  13. Expand the lib directory and select your database driver JAR file.

  14. Click OK.

  15. Click the Dependencies tab.

    The Dependencies tab appears as Figure 13-7 shows.

    Figure 13-7 Manifest Editor: Dependencies Tab

    Description of Figure 13-7 follows
    Description of "Figure 13-7 Manifest Editor: Dependencies Tab"

  16. In the Imported Packages pane, click Add.

    The Package Selection dialog appears as Figure 13-8 shows.

    Figure 13-8 Package Selection Dialog

    Description of Figure 13-8 follows
    Description of "Figure 13-8 Package Selection Dialog"

  17. In the Exported Packages field, enter org.osgi.framework.

    The list box shows all the packages with that prefix as Figure 13-8 shows.

  18. Select org.osgi.framework in the list box and click OK.

  19. Click the MANIFEST.MF tab.

    The MANIFEST.MF tab appears as Figure 13-9 shows.

    Figure 13-9 Manifest Editor

    Description of Figure 13-9 follows
    Description of "Figure 13-9 Manifest Editor"

  20. Un-JAR your database driver JAR to a temporary directory as Example 13-8 shows.

    Example 13-8 Un-JAR the Database Driver

    $ pwd
    /tmp
    $ ls com.*
    com.bea.oracle.ojdbc6_1.0.0.0_11-1-0-7.jar
    $ mkdir driver
    $ cd driver
    $ jar -xvf ../com.bea.oracle.ojdbc6_1.0.0.0_11-1-0-7.jar
    $ ls
    META-INF  oracle
    $ cd META-INF
    $ ls
    MANIFEST.MF  services
    
  21. Open your database driver JAR MANIFEST.MF file and copy its Export-Package entry and paste it into the Manifest Editor as Example 13-9 shows.

    Example 13-9 Adding Export-Package to the Manifest Editor

    Manifest-Version: 1.0
    Bundle-ManifestVersion: 2
    Bundle-Name: %project.name
    Bundle-SymbolicName: JDBCDriver
    Bundle-Version: 1.0.0
    Bundle-Localization: bundle
    Bundle-Vendor: %project.vendor
    Bundle-RequiredExecutionEnvironment: JavaSE-1.6
    Bundle-ClassPath: .
    Import-Package: com.bea.wlevs.configuration;version="11.1.1.4_0", ...
    Export-Package: oracle.core.lmx;version=1.0.0.0_11-1-0-7,oracle.core.l
     vf;version=1.0.0.0_11-1-0-7,oracle.jdbc;version=1.0.0.0_11-1-0-7,orac
     le.jdbc.aq;version=1.0.0.0_11-1-0-7,oracle.jdbc.connector;version=1.0
     .0.0_11-1-0-7,oracle.jdbc.dcn;version=1.0.0.0_11-1-0-7,oracle.jdbc.dr
     iver;version=1.0.0.0_11-1-0-7,oracle.jdbc.internal;version=1.0.0.0_11
     -1-0-7,oracle.jdbc.oci;version=1.0.0.0_11-1-0-7,oracle.jdbc.oracore;v
     ersion=1.0.0.0_11-1-0-7,oracle.jdbc.pool;version=1.0.0.0_11-1-0-7,ora
     cle.jdbc.rowset;version=1.0.0.0_11-1-0-7,oracle.jdbc.util;version=1.0
     .0.0_11-1-0-7,oracle.jdbc.xa;version=1.0.0.0_11-1-0-7,oracle.jdbc.xa.
     client;version=1.0.0.0_11-1-0-7,oracle.jpub.runtime;version=1.0.0.0_1
     1-1-0-7,oracle.net.ano;version=1.0.0.0_11-1-0-7,oracle.net.aso;versio
     n=1.0.0.0_11-1-0-7,oracle.net.jndi;version=1.0.0.0_11-1-0-7,oracle.ne
     t.ns;version=1.0.0.0_11-1-0-7,oracle.net.nt;version=1.0.0.0_11-1-0-7,
     oracle.net.resolver;version=1.0.0.0_11-1-0-7,oracle.security.o3logon;
     version=1.0.0.0_11-1-0-7,oracle.security.o5logon;version=1.0.0.0_11-1
     -0-7,oracle.sql;version=1.0.0.0_11-1-0-7,oracle.sql.converter;version
     =1.0.0.0_11-1-0-7
    
  22. Add a Bundle-Activator element to the Manifest Editor as Example 13-10 shows.

    The value of the Bundle-Activator is the fully qualified class name of your Activator class.

    Example 13-10 Adding a Bundle-Activator Element to the Manifest Editor

    Manifest-Version: 1.0
    Bundle-Activator: com.foo.MyActivator
    Bundle-ManifestVersion: 2
    Bundle-Name: %project.name
    Bundle-SymbolicName: JDBCDriver
    Bundle-Version: 1.0.0
    Bundle-Localization: bundle
    Bundle-Vendor: %project.vendor
    Bundle-RequiredExecutionEnvironment: JavaSE-1.6
    Bundle-ClassPath: .
    Import-Package: com.bea.wlevs.configuration;version="11.1.1.4_0", ...
    Export-Package: oracle.core.lmx;version=1.0.0.0_11-1-0-7, ...
    ...
    
  23. Add a DynamicImport-Package element to the Manifest Editor as Example 13-11 shows.

    Example 13-11 Adding a DynamicImport-Package Element to the Manifest Editor

    Manifest-Version: 1.0
    Bundle-Activator: com.foo.MyActivator
    Bundle-ManifestVersion: 2
    Bundle-Name: %project.name
    Bundle-SymbolicName: JDBCDriver
    Bundle-Version: 1.0.0
    Bundle-Localization: bundle
    Bundle-Vendor: %project.vendor
    Bundle-RequiredExecutionEnvironment: JavaSE-1.6
    Bundle-ClassPath: .
    DynamicImport-Package: * 
    Import-Package: com.bea.wlevs.configuration;version="11.1.1.4_0", ...
    Export-Package: oracle.core.lmx;version=1.0.0.0_11-1-0-7, ...
    ...
    
  24. Export your Oracle CEP application to a JAR file.

    For more information, see "How to Export an Oracle CEP Project" in the Oracle Fusion Middleware Developer's Guide for Oracle Complex Event Processing for Eclipse.

    Because your Oracle CEP application is an application library which contains a driver, you will copy your exported JAR to the Oracle CEP server library extensions directory.

    The Oracle CEP server library extensions directory is the DOMAIN_DIR/servername/modules/ext directory, where DOMAIN_DIR refers to the domain directory such as /oracle_cep/user_projects/domains/mydomain and servername refers to the server instance, such as myserver. For example:

    c:\oracle_cep\user_projects\domains\mydomain\myserver\modules\ext
    
  25. In the Oracle CEP server config.xml file, create a custom data-source element for your driver version and add a driver-params child element as Example 13-12 shows. For more information, see Section 1.3.1, "Oracle CEP Server Configuration Files".

    Example 13-12 driver-params Child Element

    <driver-params>
          <url>jdbc:oracle:thin:@lcw2k18:1531:lcw101</url>
          <driver-name>oracle.jdbc.xa.client.OracleXADataSource</driver-name
          <properties>
            <element>
              <name>user</name>
              <value>scott</value>
            </element>
            <element>
              <name>password</name>
              <value>{3DES}EoIfSBMhnW8=</value>
            </element>
            <element>
              <name>com.bea.core.datasource.serviceName</name>
              <value>oracle11g</value>
            </element>
            <element>
              <name>com.bea.core.datasource.serviceVersion</name>
              <value>11.2.0</value>
            </element>
            <element>
              <name>com.bea.core.datasource.serviceObjectClass</name>
              <value>javax.sql.XADataSource</value>
            </element>
          </properties>
          <use-xa-data-source-interface>true</use-xa-data-source-interface>
        </driver-params>
    

    Table 13-5 describes the relevant properties.

    Table 13-5 driver-params Child Element Properties

    Property Description

    com.bea.core.datasource.serviceName

    Specifies the value of the serviceName registration property.

    This must match the NAME property in your Activator class.

    com.bea.core.datasource.serviceVersion

    Specifies the value of the serviceVersion registration property.

    This must match the VERSION property in your Activator class.

    com.bea.core.datasource.serviceObjectClass

    Specifies the interface name of the OSGI service registration.


    For more information, see Section 13.2.2, "Custom Data Source Configuration".

  26. Stop and start the Oracle CEP server.

    For more information, see Section 1.5.4, "Starting and Stopping Oracle CEP Servers".

13.5.3 How to Access a Database Driver Using bootclasspath

Optionally, you can use the bootclasspath to access your own JDBC driver with Oracle CEP.

Oracle recommends that you use an application library instead, as Section 13.5.1, "How to Access a Database Driver Using an Application Library Built With bundler.sh" or Section 13.5.2, "How to Access a Database Driver Using an Application Library Built With Oracle CEP IDE for Eclipse" describes.

To access a database driver using bootclasspath:

  1. Update the server start script in the server directory of your domain directory so that Oracle CEP finds the appropriate JDBC driver JAR file when it boots up.

    The name of the server start script is startwlevs.cmd (Windows) or startwlevs.sh (UNIX), and the script is located in the server directory of your domain directory. The out-of-the-box sample domains are located in ORACLE_CEP_HOME/ocep_11.1/samples/domains, and the user domains are located in ORACLE_CEP_HOME/user_projects/domains, where ORACLE_CEP_HOME refers to the Oracle CEP installation directory, such as d:\oracle_cep.

    Update the start script by adding the -Xbootclasspath/a option to the Java command that executes the wlevs_3.0.jar file. Set the -Xbootclasspath/a option to the full pathname of the JDBC driver you are going to use.

    For example, if you want to use the Windows Oracle thin driver, update the java command in the start script as follows -- the updated section is shown in bold (split for readability; in practice, the command should be on one line):

    %JAVA_HOME%\bin\java -Dwlevs.home=%USER_INSTALL_DIR% -Dbea.home=%BEA_HOME%  
    -Xbootclasspath/a:%USER_INSTALL_DIR%\bin\com.bea.oracle.ojdbc14_10.2.0.jar 
    -jar "%USER_INSTALL_DIR%\bin\wlevs_3.0.jar" -disablesecurity %1 %2 %3 %4 %5 %6 
    

    In the example, %USER_INSTALL_DIR% points to ORACLE_CEP_HOME\ocep_11.1.

  2. Configure the data source in the server's config.xml file:

    1. To update the Oracle CEP server config.xml file using the Configuration Wizard, see "Creating and Updating Oracle CEP Standalone-Server Domains" in the Oracle Fusion Middleware Administrator's Guide for Oracle Complex Event Processing.

    2. To update the Oracle CEP server config.xml file manually, see Section 13.2.2, "Custom Data Source Configuration."

  3. If Oracle CEP is running, restart it so it reads the new java option and data source information.

    For more information, see Section 1.5.4, "Starting and Stopping Oracle CEP Servers".