This chapter describes how to configure Java Database Connectivity (JDBC) for use with Oracle Event Processing, including information on configuring data sources and on using Oracle and Type 4 Data Direct JDBC drivers.
This chapter includes the following sections:
Section 13.1, "Overview of Database Access from an Oracle Event Processing Application"
Section 13.2, "Description of Oracle Event Processing Data Sources"
Section 13.3, "Configuring Access to a Database Using the Oracle JDBC Driver"
Section 13.4, "Configuring Access to a Database Using the Type 4 JDBC Drivers from Data Direct"
Section 13.5, "Configuring Access to a Different Database Driver or Driver Version"
Oracle Event Processing 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 Event Processing provides the following JDBC drivers:
Oracle 11.2 thin driver (see Section 13.1.1, "Oracle JDBC Driver")
SQL Server Type 4 JDBC Driver from DataDirect (see Section 13.1.2, "Type 4 JDBC Driver for SQL Server from DataDirect")
Optionally, you can use your own JDBC driver (see Section 13.5.3, "How to Access a Database Driver Using bootclasspath").
Oracle Event Processing 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 Event Processing Data Sources".
Oracle Event Processing 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:
Oracle Event Processing 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 Event Processing 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:
Oracle Event Processing server supports different databases depending on the type of JDBC driver you use:
Section 13.1.3.1, "Databases Supported by the Oracle JDBC Driver"
Section 13.1.3.2, "Databases Supported by the Type 4 JDBC Driver for SQL Server from DataDirect"
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".
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".
Oracle Event Processing 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 Event Processing Data Source
You must use the Oracle Event Processing server default data source or configure your own Oracle Event Processing DataSource
in the server's config.xml
file if you want to access a relational database:
From an Oracle CQL processor rule
.
See "Configuring an Oracle CQL Processor Table Source" in the Oracle Fusion Middleware Developer's Guide for Oracle Event Processing for Eclipse.
From an EPL processor rule
.
See "Configuring an EPL Processor" in the Oracle Fusion Middleware Developer's Guide for Oracle Event Processing for Eclipse.
Event record and playback.
See "Storing Events in the Persistent Event Store" in the Oracle Fusion Middleware Developer's Guide for Oracle Event Processing for Eclipse.
From a cache loader or store.
See "Exchanging Data Between a Cache and Another Data Source" in the Oracle Fusion Middleware Developer's Guide for Oracle Event Processing for Eclipse.
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:
By default, the Oracle Event Processing 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 Event Processing 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 Event Processing server, by default, an Oracle Event Processing server data source retries every 10 seconds until it can create a connection. This allows the Oracle Event Processing server to successfully start up even if a database is unavailable. You can change the retry interval in the Oracle Event Processing 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".
The Oracle Event Processing 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 Event Processing 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:
Section 3.1, "Creating an Oracle Event Processing Standalone-Server Domain"
Section 5.1, "Creating an Oracle Event Processing Multi-Server Domain Using Oracle Coherence"
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 Event Processing 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 Event Processing 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 Event Processing server, by default, an Oracle Event Processing server data source retries every 10 seconds until it can create a connection. This allows the Oracle Event Processing 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 Event Processing 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 Event Processing for Eclipse.
For information on security configuration tasks that affect JDBC, see Section 10.8.3, "Configuring JDBC Security".
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.
The Oracle JDBC driver is automatically installed with Oracle Event Processing 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:
Configure the data source in the server's config.xml
file:
To update the Oracle Event Processing server config.xml
file using the Configuration Wizard, see Section 3.1, "Creating an Oracle Event Processing Standalone-Server Domain".
To update the Oracle Event Processing 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>
If Oracle Event Processing is running, restart it so it reads the new data source information.
For more information, see Section 1.5.4, "Starting and Stopping Oracle Event Processing Servers".
The type 4 JDBC drivers from DataDirect for SQL Server are automatically installed with Oracle Event Processing 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:
Configure the data source in the server's config.xml
file:
To update the Oracle Event Processing server config.xml
file using the Configuration Wizard, see Section 3.1, "Creating an Oracle Event Processing Standalone-Server Domain".
To update the Oracle Event Processing 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>
If Oracle Event Processing is running, restart it so it reads the new data source information.
For more information, see Section 1.5.4, "Starting and Stopping Oracle Event Processing Servers".
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 Event Processing or you may need to use a database driver other than the Oracle Database driver or Data Direct drivers.
This section describes the following:
Section 13.5.1, "How to Access a Database Driver Using an Application Library Built With bundler.sh": this is the preferred method; you must create an OSGi bundle for your database driver.
Section 13.5.2, "How to Access a Database Driver Using an Application Library Built With Oracle Event Processing IDE for Eclipse": this is the preferred method; you must create an OSGi bundle for your database driver.
Use this option if you wish to manually configure the activator implementation.
Section 13.5.3, "How to Access a Database Driver Using bootclasspath": this is an optional method; you do not need to create an OSGi bundle for your database driver.
This procedure describes how to create an OSGi bundle for your driver using the bundler utility and deploy it on the Oracle Event Processing 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 Event Processing IDE for Eclipse".
For more information, see "Creating Application Libraries" in the Oracle Fusion Middleware Developer's Guide for Oracle Event Processing for Eclipse.
To access a database driver using an application library built with bundler.sh:
Set up your environment as described in "Setting Your Development Environment" in the Oracle Fusion Middleware Developer's Guide for Oracle Event Processing for Eclipse.
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 Event Processing 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 |
---|---|
|
The path of the source JAR file to be bundled. |
- |
The symbolic name of the bundle. The root of the target JAR file name is derived from the name value. |
- |
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. |
- |
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 ( |
- |
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. |
|
An optional argument that specifies where to write temporary files when creating the target JAR file. Default: |
|
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 |
---|---|
|
|
|
|
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 Event Processing 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 ...
Copy the bundler JAR to the Oracle Event Processing server library extensions directory.
Because your Oracle Event Processing application is an application library which contains a driver, you copy it to the Oracle Event Processing 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 Event Processing for Eclipse.
In the Oracle Event Processing 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 Event Processing 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 |
---|---|
|
Specifies the value of the This must match the |
|
Specifies the value of the This must match the |
|
Specifies the interface name of the OSGI service registration. |
For more information, see Section 13.2.2, "Custom Data Source Configuration".
Stop and start the Oracle Event Processing server.
For more information, see Section 1.5.4, "Starting and Stopping Oracle Event Processing Servers".
This procedure describes how to create an OSGi bundle for your driver using the Oracle Event Processing IDE for Eclipse and deploy it on the Oracle Event Processing 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 Event Processing for Eclipse.
To access a database driver using an application library built with Oracle Event Processing IDE for Eclipse:
Using the Oracle Event Processing IDE for Eclipse, create a new Oracle Event Processing project.
For more information, see "Creating Oracle Event Processing Projects" in the Oracle Fusion Middleware Developer's Guide for Oracle Event Processing for Eclipse.
Right-click your project folder and select New > Folder.
Enter lib
in the Folder name field and click Finish.
Outside of the Oracle Event Processing IDE for Eclipse, copy your JDBC JAR file into the lib
folder.
Inside the Oracle Event Processing 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 Event Processing IDE for Eclipse lib Directory
Right-click the src directory and select New > Class.
The Java Class dialog appears as Figure 13-3 shows.
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, |
Name |
The name of the class. For example, |
Leave the other parameters at their default values.
Click Finish.
A new Java class is added to your project.
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(); } } }
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
Click the Runtime tab.
The Runtime tab appears as Figure 13-5 shows.
In the Classpath pane, click Add.
The JAR Selection dialog appears as Figure 13-6 shows.
Expand the lib directory and select your database driver JAR file.
Click OK.
Click the Dependencies tab.
The Dependencies tab appears as Figure 13-7 shows.
Figure 13-7 Manifest Editor: Dependencies Tab
In the Imported Packages pane, click Add.
The Package Selection dialog appears as Figure 13-8 shows.
In the Exported Packages field, enter org.osgi.framework
.
The list box shows all the packages with that prefix as Figure 13-8 shows.
Select org.osgi.framework
in the list box and click OK.
Click the MANIFEST.MF tab.
The MANIFEST.MF
tab appears as Figure 13-9 shows.
Un-JAR your database driver JAR to a temporary directory as Example 13-8 shows.
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
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, ...
...
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, ...
...
Export your Oracle Event Processing application to a JAR file.
For more information, see "How to Export an Oracle Event Processing Project" in the Oracle Fusion Middleware Developer's Guide for Oracle Event Processing for Eclipse.
Because your Oracle Event Processing application is an application library which contains a driver, you will copy your exported JAR to the Oracle Event Processing server library extensions directory.
The Oracle Event Processing 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
In the Oracle Event Processing 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 Event Processing 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 |
---|---|
|
Specifies the value of the This must match the |
|
Specifies the value of the This must match the |
|
Specifies the interface name of the OSGI service registration. |
For more information, see Section 13.2.2, "Custom Data Source Configuration".
Stop and start the Oracle Event Processing server.
For more information, see Section 1.5.4, "Starting and Stopping Oracle Event Processing Servers".
Optionally, you can use the bootclasspath to access your own JDBC driver with Oracle Event Processing.
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 Event Processing IDE for Eclipse"
describes.
To access a database driver using bootclasspath:
Update the server start script in the server directory of your domain directory so that Oracle Event Processing 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 Event Processing 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
.
Configure the data source in the server's config.xml
file:
To update the Oracle Event Processing server config.xml
file using the Configuration Wizard, see Section 3.1, "Creating an Oracle Event Processing Standalone-Server Domain".
To update the Oracle Event Processing server config.xml
file manually, see Section 13.2.2, "Custom Data Source Configuration."
If Oracle Event Processing 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 Event Processing Servers".